Code Comments
Programming Forum and web based access to our favorite programming groups.Hi, I'm having a bit of trouble with the Winsock control and was hoping someone here could help me. When I close the Winsock connection and try to reconnect anywhere from 20 seconds to 2 minutes later, I get the following message: Error 10048 Address in use. It seems if I wait longer then 2 minutes, whatever is remaining connected, times-out, and allows me to connect again. The project I am working on is still in the debugging stages and requires quite a few restarts in the VB IDE. Needless to say it's becoming a bit of an annoyance, and I wouldn't be too crazy about having my final app work in this manner either. Below is my exit code. I am using VB6 SP6 on a Windows 2000 machine. Am I missing something? Is there a KB article on Winsock bugs of this nature? (if there is, I couldn't find it). TIA Private Sub mnuExit_Click() WinSock1.Close Unload Me End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) If WinSock1.State > 1 Then Cancel = 1 End Sub Private Sub Form_Unload(Cancel As Integer) Set frmMainForm = Nothing End Sub
Post Follow-up to this message"Troy Street" <street829@comcast.net> wrote in message news:wfadnZolU6uwtu3fRVn-1g@comcast.com > Hi, > > I'm having a bit of trouble with the Winsock control and was hoping > someone here could help me. > > When I close the Winsock connection and try to reconnect anywhere > from 20 seconds to 2 minutes later, I get the following message: Error 10048 Address > in use. It seems if I wait longer then 2 minutes, whatever is > remaining connected, times-out, and allows me to connect again. before you reconnect try doing winsock1.localport=0 when you connect a local port number is assigned and that can't be re-used until the tcp/ip stack has a chance to wait for straggler packets and do it's normal cleanup processing; you can do some extra work to eliminate the delay but unless you have to use a specific local port it's normally not important. -- Reply to the group so all can participate VB.Net: "Fool me once..."
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.