For an unconnected and bound DatagramSocket, the receive method call (with SO_TIMEOUT disabled) failed unexpectedly with the following Exception.
java.net.SocketException: socket closed  
 at java.net.PlainDatagramSocketImpl.receive0(Native Method)  
 at java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java:136)  
 at java.net.DatagramSocket.receive(DatagramSocket.java:712)
Also I've not closed the socket explicitly.
This error occurred in Windows Server 2008 with JRE-6.Even on calling DatagramSocket.close(), recreating a new DatagramSocket at the same socket address failed too.
Can you please let me know the possible cause(s开发者_如何学Go) for the error?
I have met the same problem.
check the socket's "closed" and "connectState" fields.
/*
 * Connection state:
 * ST_NOT_CONNECTED = socket not connected
 * ST_CONNECTED = socket connected
 * ST_CONNECTED_NO_IMPL = socket connected but not at impl level
 */
static final int ST_NOT_CONNECTED = 0;
static final int ST_CONNECTED = 1;
static final int ST_CONNECTED_NO_IMPL = 2;
java.net.SocketException: socket closed
That means that you have closed the socket.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论