|
-
Mar 19th, 2005, 09:10 PM
#1
Thread Starter
Hyperactive Member
[RESOLVE]Check Socket Connections
Is there a way to have a socket check all its Index's to see if they are still connected and if not then it closes the index on its side and recounts?
Cause Im having a problem with a client disconnecting and the server doesnt relise it.
Thanks in advance.
Last edited by wiccaan; Mar 20th, 2005 at 01:16 AM.
If my post was helpful please rate it 
-
Mar 19th, 2005, 09:43 PM
#2
Addicted Member
Re: Check Socket Connections
i dunno about recounting and closing but i was searching forums and i found
VB Code:
Private Sub Winsock1_ConnectionRequest(Index As Integer, ByVal RequestID As Long)
Dim number As Integer
' Load another winsock then accept the connection through that winsock
If Winsock1.UBound < 1 Then 'this is our first connection so accept it
Load Winsock1(Winsock1.UBound + 1)
Winsock1(Winsock1.UBound).Accept RequestID
End If
For x = 1 To Winsock1.UBound 'loops through existing connections to amke sure we have none spare
If Winsock1(x).State <> sckConnected Then
Winsock1(x).Close
Winsock1(x).Accept RequestID
Else
If x >= Winsock1.UBound Then 'there si none spare so accept on new socket
Load Winsock1(Winsock1.UBound + 1)
Winsock1(Winsock1.UBound).Accept RequestID
Exit Sub
End If
End If
Next x
End Sub
so thats what i use until i find something thats exactly like what ur looking for
-
Mar 19th, 2005, 10:49 PM
#3
Thread Starter
Hyperactive Member
Re: Check Socket Connections
Not what I had in mind. That just closes all the sockets that are connected to my server.
If my post was helpful please rate it 
-
Mar 20th, 2005, 01:16 AM
#4
Thread Starter
Hyperactive Member
Re: Check Socket Connections
Never mind, got it to work with a little custom sub and stuff. Thanks anyway.
If my post was helpful please rate it 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|