• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to connect to server indefinately !!!  RSS feed

 
tanu dua
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi !!

I am preparing a small chat application in which i want that once the client is connected to the server,it connects indefinately.But i dont want to use infinite loop.

can anyone sort out my prob.
I have used the socket method setKeepAlive(true) but that doesnt help.So also plz tell me the functionality of that method.

Thanx
Waiting for reply.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The SO_KEEPALIVE option tells the TCP stack to occasionally (every 2 hours or so) send a packet if there has been no other traffic; this is used for detecting peers that drop off the network due to a server crash, power failure, etc. It is unrelated to what you're trying to do.

OK, now -- if you open a Socket in one process, and a ServerSocket in another, they ought to remain connected indefinitely. If they're closing, it's because the software on one end or the other is closing it. Maybe you could give us more details of exactly what you're seeing.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!