Hello guys!!! I have this problem with winsock communication... I have form1 and user controls I call it xSocks, below is my code. on form1 i have wsk listener.

xClient is xSocks User control that I used and I create a new socket on form1 for Listener purpose.
VB Code:
  1. [B]This code is on Form1[/B]
  2. Private Sub Listener_ConnectionRequest(ByVal requestID As Long)
  3. Dim i As Byte
  4.     With Listener
  5.         For i = 1 To xClient.UBound
  6.             If xClient(i).Sock_State = sckClosed Then
  7.                 xClient(i).Accept requestID
  8.                 Exit For
  9.             End If
  10.         Next
  11.     End With
  12.  
  13.     If xClient(xClient.UBound).Sock_State <> 0 Then
  14.         DoEvents
  15.         Load xClient(xClient.UBound + 1)
  16.     End If
  17. End Sub
  18.  
  19. [b]Code on xSocks User Controls[/b]
  20.  
  21. Private Sub Socket_DataArrival(ByVal bytesTotal As Long)
  22. On Error Resume Next
  23. Dim x As String
  24. Dim iClient As Integer
  25. Dim i As Byte
  26. Dim iTmp As Byte
  27.  
  28.     'Data Arrival inform of x
  29.     xSocks.GetData x
  30.  
  31.     Select Case Left(x, 2)
  32.         Case "ID"
  33.             iClient = Split(x, "~")(1)
  34.  
  35.             'check if ID# is in Server allow range
  36.             If iClient >  TotalComps Then
  37.                 SendData "ER" & "~" & "Error3" & "~" & TotalComps
  38.             End If
  39.            
  40. [COLOR=DarkOrange]'Check if ID# is used
  41.             For i = 1 To form1.xClient.UBound - 1
  42.                 If form1.xClient(i).xNum = iClient Then
  43.                     Unload form1.xClient(i)
  44.                     xNum = 0
  45.                    Exit For
  46.                 End If
  47.             Next
  48. [/COLOR]
  49.            
  50.             'Check for maximum connection
  51.             If iTmp > TotalComps Then
  52.                 SendData "ER" & "~" & "Error2"
  53.                 Exit Sub
  54.             End If
  55.            
  56.             xNum = iClient
  57.            
  58. and so on...............

My problem is the orange part... my project is working well except if workstation is terminated abnormally e.i power Off, power shutdown, Uplug pc... so in this point the connection of the client and server is disconnected abnormal, On server side the bound index is still loaded, so when I try to reconnect the workstation get connected however it won't allow to used the previous bound index which the client workstation need in order to make a connection to the server. so what I would like to do is that if the workstation try to reconnect to the server the server will unload the bound index previouslly used by workstation, and re assign it again...

anyone pls. need help badly... tnx in advance...