Add non daemon mode to constructor

This commit is contained in:
Ilya 2020-12-09 14:36:50 +03:00
parent bdffb7a457
commit 296290f5dd

View File

@ -14,14 +14,18 @@ public class TFTPServer {
private ErrorEvent errorEvent; private ErrorEvent errorEvent;
public void start() throws SocketException { public void start() throws SocketException {
start(69); start(69,true);
} }
public void start(int port) throws SocketException { public void start(int port) throws SocketException {
start(port,true);
}
public void start(int port, boolean isDaemon) throws SocketException {
socket = new DatagramSocket(port); socket = new DatagramSocket(port);
runner = new Runner(socket, this); runner = new Runner(socket, this);
thread = new Thread(runner); thread = new Thread(runner);
thread.setDaemon(true); thread.setDaemon(isDaemon);
thread.start(); thread.start();
} }