bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/28240] New: Problem with DatagramSocket.send(DatagramPack


From: listkim at gmail dot com
Subject: [Bug classpath/28240] New: Problem with DatagramSocket.send(DatagramPacket) in the connected mode
Date: 4 Jul 2006 05:53:06 -0000

On a send operation, if the packet's address is set and the packet's address
and the socket's address do not match, an IllegalArgumentException will be
thrown. (as stated in Java SE 1.4 API Document's description on the
DatagramSocket's connect method).

In the connected mode, the ¡®==¡¯ operator is used for checking whether both
packet¡¯s and connected addresses match.

So, if a packet's address is equal to the connected address but have different
InetAddress instances, then it throws an IllegalArgumentException.


[solution]
Use the InetAddress.equals() method, instead of the ¡®==¡¯ operator. (the
method only checks whether both addresses¡¯ byte arrays are same, but not the
instances))


-- 
           Summary: Problem with DatagramSocket.send(DatagramPacket) in the
                    connected mode
           Product: classpath
           Version: 0.92
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: classpath
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: listkim at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28240





reply via email to

[Prev in Thread] Current Thread [Next in Thread]