Wednesday, April 25, 2012

Rebinding a port to datagram socket on a difftent IP

In my application I hyave created a datagarm socket and binded a port say 9999 to ip 192.168.173.1 now i want to bind the port to a new ip say 192.168.173.2
but i am not able to do it
Steps i followed
1 DatagramSocket s= new DatagramSocket(port,ip1);
2 s.disconnect();



s.close();



s= new DatagramSocket(port,ip2);



but this gives a java,net,BindException :Address already in use : Cannot bind
any insight would be very helpfull





No comments:

Post a Comment