Java: How to clear socket bindings

Posted by Matt1776 on Stack Overflow See other posts from Stack Overflow or by Matt1776
Published on 2010-05-13T19:18:19Z Indexed on 2010/05/13 19:34 UTC
Read the original article Hit count: 132

Filed under:
|

I am having a few issues with sockets within my Java SIP client. When I bind to an address and port, if something goes wrong I have to attempt to reconnect, usually after I've stopped and restarted the process. Problem with that is then the port is bound and I am forced to increment the local port.

How can I remove the binding to the port I am targeting before binding to it?

If that isnt possible, then how can I trap the process just before it ends so that I can locate the socket binding and close it manually?

© Stack Overflow or respective owner

Related posts about java

Related posts about port