Results 1 to 3 of 3

Thread: When Disconnect, Listen after

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2006
    Location
    New Brunswick, Canada
    Posts
    30

    Question When Disconnect, Listen after

    What I need is when I disconnect on client it will disconnect on client and server then right after for it to listen on server..know what I mean ?

  2. #2
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: When Disconnect, Listen after

    yea i know what you mean, heres the server Winsock_Close event:

    VB Code:
    1. 'Basically this event fires when the client disconnects
    2. Private Sub Winsock1_Close()
    3.     Winsock1.Close 'Return to closed state
    4.     Winsock1.Listen 'Listen for another connection
    5. End Sub

    I would put the code in the Winsock_Error event also, so if the socket errors for any reason, it will close and listen for a new connection.

    in your client Winsock_Close and Error events you should have something like this...
    VB Code:
    1. Winsock.Close
    2. Label1.Caption = "Disconnected"
    Last edited by the182guy; Mar 5th, 2006 at 05:30 AM.
    Chris

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Feb 2006
    Location
    New Brunswick, Canada
    Posts
    30

    Re: When Disconnect, Listen after

    ohya thats I wasn't thinkin of Winsock_Close sub XD thanks very much

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