Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Winsock
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




Report this thread to moderator Post Follow-up to this message
Old Post
Troy Street
04-28-05 08:56 AM


Re: Winsock
"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..."


Report this thread to moderator Post Follow-up to this message
Old Post
Bob Butler
04-28-05 08:56 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Visual Basic archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:33 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.