Results 1 to 40 of 163

Thread: [RESOLVED] [2008] Can I add a TCPClient Component

Threaded View

  1. #11
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [2008] Can I add a TCPClient Component

    Quote Originally Posted by perito
    OK, it worked gr8
    Now how to figure out if a client disconnected from my server?
    thx
    The ideal thing is to have the client send a message whenever it closes down. When the server receives this message it should simply remove him from the list of connected clients.

    However, if the client closes because of the system crashing or something of the sort, sending a message is obviously not possible. We will solve this by adding some nifty code when the exception occures in the doRead subroutine. But in order to do this we will need to change the ConnectedClients constructor, I'm going to update the code again..

    Edit: There now I've edited the code.
    Notice the new constructor in the ConnectedClient class, it takes one more argument, an the instance of Form1.
    So upon creating a new ConnectedClient class, (on the doListen subroutine) we pass it like so: New ConnectedClass(incomingClient, Me)

    This is because we want to call the new subroutine 'removeClient' from within ConnectedClass, like you can see being done in the doRead subroutine.
    I hope this isnt too confusing for you
    Last edited by Atheist; Jan 4th, 2008 at 09:10 AM.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

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