View Single Post
Old Feb 15th, 2006, 9:41 PM   #1
krazyshane
Newbie
 
Join Date: Dec 2005
Posts: 7
Rep Power: 0 krazyshane is on a distinguished road
Java Socket Timouts in a Chat client/server

Okay, I have created a chat client/server application in Java. This was a fun project and was my first experience with multithreading and sockets.

The code works great. I have a working chat client/server that allows for multiple users, user listings, formatting type etc.

My question is about timing out. It seems that the client will stay connected indefinitely as long as there is chat going on. If however there is not, the client will be disconnected (I dont know what the timout is).

Anyways, I've thought about just having a timer thread that sends a packet just to keep the connection alive after (x minutues). Is there a simpler way to ensure that the connection wont timeout? If not, how long should i wait between keepalive packets?

Thanks,
Shane
krazyshane is offline   Reply With Quote