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:
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:
Private Sub sckServer_ConnectionRequest(index As Integer, ByVal requestID As Long) If index = 0 Then intWIndex = intWIndex + 1 Load sckServer(intWIndex) sckServer(intWIndex).Accept requestID AddLog "Socket connection request accepted -> index = " & intWIndex End If
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.VB Code:
Private Sub sckServer_Error(index As Integer, ByVal Number As Integer, _ Description As String, ByVal sCode As Long, ByVal Source As String, ByVal _ HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean) If index = 0 Then Exit Sub 'close connection sckServer(index).Close 'unload socket Unload sckServer(index) End Sub
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.




Reply With Quote