Results 1 to 2 of 2

Thread: Winsock Ping Timeout

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    113

    Winsock Ping Timeout

    I have a client/server app and on the server.exe it shows a list of all the connected clients. My problem is that if a client incorrectly closes the program (example: turns off their computer) the IP will remain there. Is there something I can do to check if the client is connected to the server? I also wish to have this check be regular for all clients connected to the server.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Winsock Ping Timeout

    In your program, do you have any code in the QueryUnload event?

    If not, you can code that to detect a shutdown. Example:
    Code:
    Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    'there are 5 unloadmode levels
            Select Case UnloadMode
                Case vbFormControlMenu 'UnloadMode 0
                     'form is being unloaded via the Close
                     'or by hitting the X in the upper right hand corner
                     'command from the System menu
                Case vbFormCode        'UnloadMode 1
                     'Unload Me has been issued from code
                Case vbAppWindows      'UnloadMode 2
                     'Windows itself is closing
                Case vbAppTaskManager  'UnloadMode 3
                     'the Task Manager is closing the app
                Case vbFormMDIForm     'UnloadMod 4
                     'an MDI child form is closing because
                     'its parent form is closing
            End Select
    End Sub
    I would play around with vbAppWindows......if someone just shuts their PC off with your program running, then that event might pick it up.

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