/** * Starts the listener thread that accepts incoming messages. The thread is started in daemon mode * and thus it will not block application terminated. Nevertheless, the {@link #close()} method * should be called to stop the listen thread gracefully and free associated ressources. * * @throws IOException */ public synchronized void listen() throws IOException { if (listener != null) { throw new SocketException("Port already listening"); } ensureSocket(); listenerThread = new ListenThread(); listener = SNMP4JSettings.getThreadFactory() .createWorkerThread("DefaultUDPTransportMapping_" + getAddress(), listenerThread, true); listener.run(); }