Results 1 to 9 of 9

Thread: winsock question

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2004
    Location
    Philippines
    Posts
    285

    Exclamation winsock question

    hi everyone, i have this really annoying problem. hope you guys could help me out.

    i have a multi client chat program that uses winsock. in the server side, i have an array of winsocks. once a client connects, a new instance of winsock is loaded to accept that connection request. the code looks like the example below:
    VB Code:
    1. Private Sub sckServer_ConnectionRequest(index As Integer, ByVal requestID As Long)
    2.    If index = 0 Then
    3.       intWIndex = intWIndex + 1
    4.      
    5.       Load sckServer(intWIndex)
    6.       sckServer(intWIndex).Accept requestID
    7.      
    8.       AddLog "Socket connection request accepted -> index = " & intWIndex
    9. End If
    now my problem is, in some time while the program is running, some of the winsock in the server gets this error ''Connection is aborted due to timeout or other failure" but in the client side there is no winsock error for that particular connection. i have this code to handle this error :
    VB Code:
    1. Private Sub sckServer_Error(index As Integer, ByVal Number As Integer, _
    2.    Description As String, ByVal sCode As Long, ByVal Source As String, ByVal _
    3.    HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
    4.    
    5.    If index = 0 Then Exit Sub
    6.    
    7.    'close connection
    8.    sckServer(index).Close
    9.    
    10.    'unload socket
    11.    Unload sckServer(index)
    12. End Sub
    in the client side, whenever a winsock error occurs, i close the connection and i have a timer enabled so that the client would automatically try to reconnect to the server. but since no winsock error occurred, the client will not try to reconnect.

    do you guys have any idea why no error event fired in the client side? how can i work around this problem? any help would be greatly appreciated.
    Last edited by guyjasper; Jul 18th, 2005 at 04:26 AM.

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