In my application there will be one thread which always be running and will be sending or listening to some port.
This application runs in the background. Sometimes while creating the socket, i found that the port which was used by the same thread before, is not getting released on close() of the socket. So i tried like this
dc = new DatagramSocket(inetAddr);
dc.setReuseAddress(true);
The problem is , it is not reaching to the second line also. in the first line itself i am getting the expcetion BindException: Address already in use
.
Can anyone please help me how to handle this is situation.
Is there any way to release the port ?
Thanks & Regards,
SSuman185