0

In reference to this question: What is the background that a java.net.DatagramSocket supports a "connected" state?

I would have expected that the isConnected() method always returns false, since UDP/datagram sockets do not support a connected state. But a quick look at the sources shows that there is some logic behind the isConnected() method. Why?

Community
  • 1
  • 1
Andreas Fester
  • 36,091
  • 7
  • 95
  • 123

1 Answers1

3

Read the Javadoc. When you "connect" a DatagramSocket to a remote IP/port you are just telling the socket not to accept packets to or from any other remote host.

Jim Garrison
  • 85,615
  • 20
  • 155
  • 190