This Winsock control is being reused a second time, and ultimately a third time, etc. Its LocalPort property is not being reset to zero (0) before re-using it, i.e. Connect being called again.
A Winsock "address" consists of the protocol (TCP vs. UDP), local port number, and local IP address taken together in this context. Using a LocalPort of 0 tells Winsock to allocate a free ephemeral port and assign it for you. It's a bit like using FreeFile() to allocate a file number for VB native I/O operations.
Last edited by dilettante; Aug 15th, 2007 at 09:31 AM.