Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

closing client threads in chat program  RSS feed

 
prabhat gupta
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I m writing a chat application in which a client thread runs on the server side.This happens whenever a new socket connection is asked at the server by a client.so for 100 users 100 threads are running on the server .Till now everything is running fine.But i m facing difficulties in closing threads for those clients who logout.
Also my question is what to close first.should it be the client thread running on the server or the client application itself .
what i m trying to do is send a message saying user so and so is logging out and this message is followed by the user thread being stopped at the server.I m getting exceptions saying that the "jvm peer closed" or "socket exception" ie i m not able to close the streams in the right sequence.
please sugest how to execute this.
 
Jim Baiter
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
FWIW, you might want to check out the JDK 1.4 NIO features. http://java.sun.com/j2se/1.4/docs/guide/nio/index.html
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!