• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reconnecting Sockets

 
Richard West
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I did a simple test program in which i created a server socket and a socket. The socket can connect to host but after it is disconnected, it cannot reconnect anymore. I read i some website that java sockets once disconnect can be reconnected. Is this true?

If this is true is there any way in which i can reset the server and client so that the socket can reconnect to the server.

Sample codes or a detailed explantion about client reconeection would be helpful

Thank You

Yours Sincerely

Richard West
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This in the Socket.close() javadoc does not look promising:
Once a socket has been closed, it is not available for further networking use (i.e. can't be reconnected or rebound). A new socket needs to be created.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!