ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/server/uk/org/iscream/cms/server/filter/UDPReader.java
(Generate patch)

Comparing projects/cms/source/server/uk/org/iscream/cms/server/filter/UDPReader.java (file contents):
Revision 1.12 by tdb, Fri Jan 12 00:45:25 2001 UTC vs.
Revision 1.14 by tdb, Sun Jan 28 05:34:38 2001 UTC

# Line 6 | Line 6 | import java.io.*;
6   import java.net.*;
7   import java.util.*;
8   import uk.ac.ukc.iscream.core.*;
9 + import uk.ac.ukc.iscream.componentmanager.*;
10   import uk.ac.ukc.iscream.filter.*;
11   import uk.ac.ukc.iscream.util.*;
12  
13   /**
14   * This class contains the main method to be run by
15 < * the filter children.  It harvests UDP traffic.
15 > * the filterd.  It harvests UDP traffic, and queues it.
16   *
17   * @author  $Author$
18   * @version $Id$
# Line 35 | Line 36 | public class UDPReader extends Thread{
36   //---CONSTRUCTORS---
37  
38      /**
39 <     * It is normal to use this constructor in preference
40 <     * to any other in this class.
39 >     * Constructs a new UDPReader.
40 >     *
41 >     * @param port The port on which we listen for UDP data
42 >     * @param queue The queue which we are using
43       */
44      public UDPReader(int port, Queue queue){
45          _port = port;
# Line 44 | Line 47 | public class UDPReader extends Thread{
47      }
48  
49   //---PUBLIC METHODS---
50 <
50 >    
51 >    /**
52 >     * The main method in the class. Reads and queues XML sent
53 >     * over UDP.
54 >     */
55      public void run() {
56 <
56 >        
57 >        // setup a Datagram socket
58          DatagramSocket socket = null;
59          try {
60              socket = new DatagramSocket(_port);
# Line 64 | Line 72 | public class UDPReader extends Thread{
72  
73          byte[] buf;
74          
75 +        // read UDP packets and queue them
76          boolean running = true;
77          while (running){
78              try {
# Line 77 | Line 86 | public class UDPReader extends Thread{
86              }
87              catch (IOException e) {
88                  _logger.write(this.toString(), Logger.WARNING, "This UDPReader thread has been shut down as an exception occured: "+e);
89 <                return;
89 >                running = false;
90              }
91          }
92          socket.close();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines