Results 1 to 8 of 8

Thread: Number of connected clients displayed is incorrect

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2006
    Posts
    40

    Exclamation Number of connected clients displayed is incorrect

    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:
    VB Code:
    1. Private Sub Form_Load()
    2.     Socket(0).LocalPort = 9301
    3.     Socket(0).Listen
    4. End Sub
    5.  
    6. Private Sub socket_ConnectionRequest(Index As Integer, ByVal requestID As Long)
    7.   Load Socket(Socket.UBound + 1)
    8.   Socket(Socket.UBound).Accept requestID
    9.  List1.AddItem requestID & " from " & Socket(Index).RemoteHostIP & " - " & Index
    10.  
    11. End Sub
    display number of connections code (timer interval is 5000 msec)
    VB Code:
    1. Public Sub TChkCnctState_Timer()
    2.     sckCount = 0
    3.     For i = Socket.LBound To Socket.UBound
    4.        If Socket(i).State = sckConnected Then sckCount = sckCount + 1
    5.     Next i
    6.     lblConnections.Caption = sckCount
    7. End Sub
    Last edited by dlern; Jan 23rd, 2006 at 05:12 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