I am running a server, multiple client network. Pretty much all is working correctly.
Part of the program displays the active number of client computers. As new workstations join the network, the server adds to the displayed number of connected clients, and as each client closes the client software, the server correctly changes the displayed number of connected computers.
BUT
If a client is forcibly shut down (e.g. holding the power button) while the client program is running, the server still displays that computer's connection state as connected(7).
Suggestions?
Connection code:display number of connections code (timer interval is 5000 msec)VB Code:
Private Sub Form_Load() Socket(0).LocalPort = 9301 Socket(0).Listen End Sub Private Sub socket_ConnectionRequest(Index As Integer, ByVal requestID As Long) Load Socket(Socket.UBound + 1) Socket(Socket.UBound).Accept requestID List1.AddItem requestID & " from " & Socket(Index).RemoteHostIP & " - " & Index End SubVB Code:
Public Sub TChkCnctState_Timer() sckCount = 0 For i = Socket.LBound To Socket.UBound If Socket(i).State = sckConnected Then sckCount = sckCount + 1 Next i lblConnections.Caption = sckCount End Sub




Suggestions?
Reply With Quote