public void dispose(){
  isRunning=false;
  _myThread=null;
  if (_myDatagramSocket != null) {
    if (_myDatagramSocket.isConnected()) {
      Logger.printDebug("UdpServer.dispose()","disconnect()");
      _myDatagramSocket.disconnect();
    }
    Logger.printDebug("UdpServer.dispose()","close()");
    _myDatagramSocket.close();
    _myDatagramSocket=null;
    Logger.printDebug("UdpServer.dispose()","Closing unicast datagram socket.");
  }
}

public void dispose ( ) { isRunning = false ; _myThread = null ; if ( _myDatagramSocket != null ) { if ( _myDatagramSocket . isConnected ( ) ) { Logger . printDebug ( "UdpServer.dispose()" , "disconnect()" ) ; _myDatagramSocket . disconnect ( ) ; } Logger . printDebug ( "UdpServer.dispose()" , "close()" ) ; _myDatagramSocket . close ( ) ; _myDatagramSocket = null ; Logger . printDebug ( "UdpServer.dispose()" , "Closing unicast datagram socket." ) ; } }
stop the udp server , clean up and delete its reference .
