port problem

chris
01-31-2002, 05:09 PM
i have a winsock connection and every time i make a connection then exit the program, then if i try to reastablish the connection using the same port it wont work. any way i can free up that port or something?

Ales Zigon
01-31-2002, 05:56 PM
Do you close your conn/port propperly?
Code?

chris
01-31-2002, 06:23 PM
i've tryed adding Client.close ,Server.close but the other winsock control is an array.

Ales Zigon
01-31-2002, 06:31 PM
Not sure, but you should close all connections before exiting the app. If you have an array of winsocks then you should close them all too.

chris
01-31-2002, 06:33 PM
how would i close the array?

Ales Zigon
01-31-2002, 06:45 PM
Loop through the array. Something like this:
Private Sub Form_Unload(Cancel As Integer)
Dim n%
For n = 0 To Winsock1.Count - 1
If Winsock1(n).State <> sckClosed Then
Winsock1(n).Close
End If
Next n
End Sub


This will loop throuhg all the Winsocks in the array and close any one that has been left open.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum