This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Distributed Java and the fly likes How do you formally disconect a client from a server? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Distributed Java
Reply Bookmark "How do you formally disconect a client from a server?" Watch "How do you formally disconect a client from a server?" New topic
Author

How do you formally disconect a client from a server?

Eric Larsen
Ranch Hand

Joined: Mar 28, 2009
Posts: 35
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

Joined: Mar 22, 2000
Posts: 12268
    
    1
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

Java Resources at www.wbrogden.com
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How do you formally disconect a client from a server?
 
Similar Threads
Best way for login authentication
Help with Chat software
Client disconnected from server after about 10 minutes of inactivity
I need help improving this chat server and chat client!
Usability features