aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes restarting and stopping serversocket running on port Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "restarting and stopping serversocket running on port" Watch "restarting and stopping serversocket running on port" New topic
Author

restarting and stopping serversocket running on port

Ponnusamy Gov
Greenhorn

Joined: Feb 01, 2011
Posts: 17
Dear All,

I have a client server methodology in which I am using java ServerSocket connection to act as a server which will always looking for client request. This server will be running in a specified port like 4444, 4445,etc..,. I don't know how to stop that server because I am unable to take the ServerSocket instance running on port. So to achieve server stopping, I used to kill the process abruptly but this is not a proper way of stopping the server the server since my server is handling N number client requests concurrently and middle of the process if I kill this, tasks which is being handled by all the threads will go off. I am using ArrayBlockingQueue for queuing up the client requests. currently I am having 100 of Max thread pool size. Can any one help me out regarding this?

Sample piece of code:

to start the server :




Server code:



Please help me to stop the server by giving running port number. My applicaiton is running in sun solaris server.

Thanks in advance,

Pons.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: restarting and stopping serversocket running on port
 
Similar Threads
Not getting the bytes sent
simple wait & notify
Reading a binary file from a client to server
Data from server is not sent to client
Socket : MultiClient Server