This discussion is archived
5 Replies Latest reply: Mar 23, 2012 5:13 AM by 925484 RSS

DatagramSocket.send() gives a BindException on XP but not Windows 7

925484 Newbie
Currently Being Moderated
I have a USB device connected to my PC which i send data to using a DatagramSocket.send().

When i disconnect or power off my device, i wish to handle an exception if data is sent to the device.
The following code gives a BindException ( Cannot assign requested address: Datagram send failed) on XP, but not in Windows 7:

DatagramSocket socket = new DatagramSocket(port, InetAddress.getByName(ipAddress));
DatagramPacket packet = new DatagramPacket(messageBytes, messageBytes.length, recipient, receiverPort);

Is there any difference between XP and Windows 7 when it comes to sending UDP packets?

I'm using jdk.1.6.0_18


  • Correct Answers - 10 points
  • Helpful Answers - 5 points