--- experimental/server/XMLReader/UDPReader.java 2000/11/21 09:38:27 1.7 +++ experimental/server/XMLReader/UDPReader.java 2000/11/21 10:27:24 1.9 @@ -19,6 +19,11 @@ public class UDPReader extends Thread{ this(4589, logger); } + public void receiveXML(String xml){ + UDPReaderThread t = new UDPReaderThread(); + t.run(xml); + } + public void run() { DatagramSocket socket = null; @@ -26,16 +31,15 @@ public class UDPReader extends Thread{ socket = new DatagramSocket(port); } catch (BindException e){ - System.out.println("Some other process is already listening on port "+port+"."); - System.out.println("Please specify another port number on the command line."); + logger.write(this.toString(), Logger.SYSMSG, "Could not start the UDPReader thread on port "+port+" as this port was already in use."); return; } catch (Exception e){ - System.out.println("An exception occured while creating the DatagramSocket."); + logger.write(this.toString(), Logger.SYSMSG, "Could not start the UDPReader thread on port "+port+"."); return; } - System.out.println("UDPReader ready and listening for UDP packets on port "+port); + logger.write(this.toString(), Logger.SYSMSG, "UDPReader thread ready and listening for UDP packets on port "+port); byte[] buf; @@ -50,8 +54,8 @@ public class UDPReader extends Thread{ t.run(packet); } catch (IOException e) { - System.out.println("An exception occured in the UDPReader!"); - e.printStackTrace(); + logger.write(this.toString(), Logger.SYSMSG, "The UDPReader thread has been shut down as an exception occured: "+e); + return; } } socket.close();