5 Replies Latest reply on Mar 23, 2012 12:13 PM by 925484

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

      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 (java.net.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