This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do you formally disconect a client from a server?

 
Eric Larsen
Ranch Hand
Posts: 35
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey, everybody. I'm writing a chat server and client, and I've noticed that whenever I just shut down the client, the server throws an error, but no functionality is affected. In fact, if it weren't for the fact that I have the CLI for the server open whenever I'm running it, I wouldn't have noticed this at all. Is this even worth the time to fix? If so, how would I do that? I'm using plain Sockets, by the way.

Client source code:



The server source code:

 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13047
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this even worth the time to fix? If so, how would I do that?


Good practice would be to catch the exception, log the fact that the client disconnected and clean up any resources in use.

Bill
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic