Microsoft KB Archive/819107

= Mailslot programs may be slow in Windows 2000 =

Article ID: 819107

Article Last Modified on 2/28/2007

-

APPLIES TO


 * Microsoft Windows 2000 Advanced Server
 * Microsoft Windows 2000 Professional Edition
 * Microsoft Windows 2000 Server

-





SUMMARY
This article discusses why mailslot programs may appear to be slower in Microsoft Windows 2000 than in Microsoft Windows NT 4.0.



SYMPTOMS
After you upgrade a Windows NT 4.0 system to Windows 2000, you may notice slow performance in mailslot programs. Calls to the WriteFile function may return after a long delay on Windows 2000-based systems.



CAUSE
In Windows NT 4.0, if the mailslot name or the computer name that is specified in the CreateFile function does not exist, the WriteFile function returns confirmation immediately and then sends a datagram.

NetBIOS over TCP/IP (NetBT) behavior changed in Windows 2000. Windows 2000 first tries to resolve the computer name. Windows 2000 returns confirmation only if it successfully resolves the name. (Because the datagram is unreliable, the confirmation is no guarantee that the datagram reached its destination). The change to NetBT was made so that certain clients, such as the Net Logon service, would know whether the datagram was sent beyond NetBT.

If a Windows 2000-based client program calls the CreateFile function with the &quot;\\\\ \\mailslot\ &quot; string, and  cannot be found on the network, subsequent calls to the WriteFile function fail with the &quot;System error 53 ERROR_BAD_NETPATH&quot; error. This scenario indicates whether the recipient of the mailslot message exists.

In Windows NT 4.0, when the CreateFile function is called with a computer name, such as with the &quot;\\\\ \\mailslot\myslot&quot; string, the client program uses the following procedure to resolve the computer name to an IP address:
 * 1) The client program sends a broadcast to the subnet.
 * 2) If the broadcast fails after three tries, the client program sends a name query request to all Windows Internet Name Service (WINS) servers.
 * 3) If the name query fails, the WriteFile function returns a confirmation to Windows NT 4.0.

Windows 2000 uses the following procedure for default name resolution:
 * 1) Windows 2000 sends a request to WINS.
 * 2) If the request fails, Windows 2000 sends a broadcast to the subnet.
 * 3) If three broadcasts do not generate a response, Windows 2000 sends a query to DNS.
 * 4) If the query fails, the WriteFile function fails with error 53.



WORKAROUND
To work around this issue, use the WriteFile function or the WriteFileEx function asynchronously.

Another possible workaround is to install the NetBEUI protocol on the local area network (LAN) adapter. This configuration makes the mailslot program behave as it does in Windows NT 4.0.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.



MORE INFORMATION
If the client and server mailslot programs are both running in Windows 2000, the server program does not receive any data from the client program if the data is more than 426 bytes. This behavior is by design in Windows 2000. Because mailslot programs cannot be used to send more than 426 bytes from a Windows 2000-based client to a Windows 2000-based server, use named pipes or Windows Sockets (winsock) for larger amounts of data.

Note
 * If more than one protocol is installed on your computer, the mailslot program will use all protocols to send messages.
 * Mailslot programs are an older technology. We do not recommend using mailslot programs. NetBEUI is not supported in Microsoft Windows XP.

