PRB: Winsock Control Generates Error 10048 - Address in Use (173619)
The information in this article applies to:
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
This article was previously published under Q173619 SYMPTOMS
The Winsock control will get an error after a Connect method is called if
the same local port has been used within the past four minutes.
CAUSE
The Windows socket control does not have the ability to set the socket
option SO_REUSEADDR. This option allows the socket to be bound to an
address that is already in use.
When you close the handle to a socket, some additional negotiation goes on
between the client and the server. The socket will wait for up to two times
the maximum time that windows would wait to receive an acknowledgement from
the other end of the socket that closed the port. By default, this option
is set to two minutes. Therefore, Windows may wait up to four minutes
before the port is actually released.
This makes that specific port unavailable until it is actually released.
RESOLUTION
The only workaround is to not use a specific local port. If you set the
LocalPort property to Zero, Winsock will pick a random local port for you
and use it until a Close method is called on the WinSock Control.
STATUS
This behavior is by design.
Modification Type: | Major | Last Reviewed: | 4/28/2000 |
---|
Keywords: | kbAPI kbCtrl kberrmsg kbnetwork kbprb kbWinsock KB173619 |
---|
|