Socket.setKeepAlive()?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Socket.setKeepAlive()?

  1. #1
    Lim Wing Hoe Guest

    Socket.setKeepAlive()?

    Let's say I use this method in my online users list program as stated in the
    previous post. If the client fails, e.g. connection loss, the socket that
    was spawned from the ServerSocket to handle this thread will get a
    SocketException right?

    If this is the case, then I can possibly use this option to perform the
    removal of the user from the online users list, isn't it?

    Oh yeah, btw, should I use setKeepAlive() or getKeepAlive()?

    Not to mention, is the socket setKeepAlive()=true as default? Or do I have
    to explicitly setKeepAlive to true?
    --



    Best Regards,
    Wing Hoe
    ---------------------------------------------------------------
    ICQ: 2213281
    Email: winghoe@hotmail.com
    www: http://pwp.maxis.net.my/winghoe
    ---------------------------------------------------------------









  2. #2
    Ruchi Dhar Guest

    Re: Socket.setKeepAlive()?


    The best way to solve this situation is when your connection is established
    between client and server provide some kind of protocol which tells the server
    or client whether they are alive. You can set some time interval and set
    up some kind of protocol which lets the client and serve know each other
    still the connection is live.

    "Lim Wing Hoe" <winghoe@hotmail.com> wrote:
    >Let's say I use this method in my online users list program as stated in

    the
    >previous post. If the client fails, e.g. connection loss, the socket that
    >was spawned from the ServerSocket to handle this thread will get a
    >SocketException right?
    >
    >If this is the case, then I can possibly use this option to perform the
    >removal of the user from the online users list, isn't it?
    >
    >Oh yeah, btw, should I use setKeepAlive() or getKeepAlive()?
    >
    >Not to mention, is the socket setKeepAlive()=true as default? Or do I have
    >to explicitly setKeepAlive to true?
    >--
    >
    >
    >
    >Best Regards,
    >Wing Hoe
    >---------------------------------------------------------------
    >ICQ: 2213281
    >Email: winghoe@hotmail.com
    >www: http://pwp.maxis.net.my/winghoe
    >---------------------------------------------------------------
    >
    >
    >
    >
    >
    >
    >
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center