I have really problem, i try to terminate the server connection from listing on specific port but it is still listing and i get these exceptions when i close the connection.
i am using JDK1.6.
Close Connection code:
Exceptions when Close Connection:
I desperately need help.
thanks.
William Brogden
,
Author and all-around good cowpoke
The way I read the JavaDocs for java.nio.channels.ClosedChannelException, this indicates that "an attempt is made to invoke or complete an IO operation upon a channel that is closed or at least closed to that operation."
Are there other Threads that may be using this port?
Bill
Ernest Friedman-Hill
,
author and iconoclast
staff
It's not at all surprising that "accept" would throw an exception if you close the socket channel it's trying to use -- sounds like expected behavior. Either wrap your calls to accept() in a try/catch block to handle shutdown, or don't shut down the socket while accept() is running -- and of course don't call accept() again after the socket has been closed!