Results 1 to 4 of 4

Thread: [RESOLVE]Check Socket Connections

  1. #1

    Thread Starter
    Hyperactive Member wiccaan's Avatar
    Join Date
    Apr 2004
    Location
    127.0.0.1
    Posts
    475

    Resolved [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

  2. #2
    Addicted Member
    Join Date
    Mar 2005
    Posts
    238

    Re: Check Socket Connections

    i dunno about recounting and closing but i was searching forums and i found

    VB Code:
    1. Private Sub Winsock1_ConnectionRequest(Index As Integer, ByVal RequestID As Long)
    2. Dim number As Integer
    3.   ' Load another winsock then accept the connection through that winsock
    4.   If Winsock1.UBound < 1 Then 'this is our first connection so accept it
    5.        Load Winsock1(Winsock1.UBound + 1)
    6.        Winsock1(Winsock1.UBound).Accept RequestID
    7. End If
    8.  
    9. For x = 1 To Winsock1.UBound 'loops through existing connections to amke sure we have none spare
    10.    If Winsock1(x).State <> sckConnected Then
    11.           Winsock1(x).Close
    12.           Winsock1(x).Accept RequestID
    13.    Else
    14.    If x >= Winsock1.UBound Then 'there si none spare so accept on new socket
    15.             Load Winsock1(Winsock1.UBound + 1)
    16.             Winsock1(Winsock1.UBound).Accept RequestID
    17.             Exit Sub
    18.        End If
    19.  
    20.  
    21.         End If
    22.         Next x
    23. End Sub

    so thats what i use until i find something thats exactly like what ur looking for

  3. #3

    Thread Starter
    Hyperactive Member wiccaan's Avatar
    Join Date
    Apr 2004
    Location
    127.0.0.1
    Posts
    475

    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

  4. #4

    Thread Starter
    Hyperactive Member wiccaan's Avatar
    Join Date
    Apr 2004
    Location
    127.0.0.1
    Posts
    475

    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
  •  



Click Here to Expand Forum to Full Width