ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/experimental/server/XMLReader/UDPReader.java
(Generate patch)

Comparing experimental/server/XMLReader/UDPReader.java (file contents):
Revision 1.6 by pjm2, Tue Nov 21 09:15:06 2000 UTC vs.
Revision 1.9 by pjm2, Tue Nov 21 10:27:24 2000 UTC

# Line 19 | Line 19 | public class UDPReader extends Thread{
19          this(4589, logger);
20      }
21  
22 +    public void receiveXML(String xml){
23 +        UDPReaderThread t = new UDPReaderThread();
24 +        t.run(xml);
25 +    }
26 +
27      public void run() {
28  
29          DatagramSocket socket = null;
# Line 26 | Line 31 | public class UDPReader extends Thread{
31              socket = new DatagramSocket(port);
32          }
33          catch (BindException e){
34 <            System.out.println("Some other process is already listening on port "+port+".");
30 <            System.out.println("Please specify another port number on the command line.");
34 >            logger.write(this.toString(), Logger.SYSMSG, "Could not start the UDPReader thread on port "+port+" as this port was already in use.");
35              return;
36          }
37          catch (Exception e){
38 <            System.out.println("An exception occured while creating the DatagramSocket.");
38 >            logger.write(this.toString(), Logger.SYSMSG, "Could not start the UDPReader thread on port "+port+".");
39              return;
40          }
41          
42 <        System.out.println("UDPReader ready and listening for UDP packets on port "+port);
42 >        logger.write(this.toString(), Logger.SYSMSG, "UDPReader thread ready and listening for UDP packets on port "+port);
43  
44          byte[] buf;
41        UDPReaderThread t = new UDPReaderThread();
45          
46          boolean running = true;
47          while (running){
# Line 47 | Line 50 | public class UDPReader extends Thread{
50                  // receive request
51                  DatagramPacket packet = new DatagramPacket(buf, buf.length);
52                  socket.receive(packet);
53 +                UDPReaderThread t = new UDPReaderThread();
54                  t.run(packet);
55              }
56              catch (IOException e) {
57 <                System.out.println("An exception occured in the UDPReader!");
58 <                e.printStackTrace();
57 >                logger.write(this.toString(), Logger.SYSMSG, "The UDPReader thread has been shut down as an exception occured: "+e);
58 >                return;
59              }
60          }
61          socket.close();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines