1 |
+ |
//---PACKAGE DECLARATION--- |
2 |
+ |
package uk.ac.ukc.iscream.filter; |
3 |
+ |
|
4 |
+ |
//---IMPORTS--- |
5 |
|
import java.io.*; |
6 |
|
import java.net.*; |
7 |
|
import java.util.*; |
8 |
|
import uk.ac.ukc.iscream.core.*; |
9 |
|
import uk.ac.ukc.iscream.filter.*; |
10 |
|
|
11 |
< |
// This class contains the main method to be run by |
12 |
< |
// the filter children. It harvests UDP traffic. |
13 |
< |
// |
11 |
> |
/** |
12 |
> |
* This class contains the main method to be run by |
13 |
> |
* the filter children. It harvests UDP traffic. |
14 |
> |
* |
15 |
> |
* @author $Author$ |
16 |
> |
* @version $Id$ |
17 |
> |
*/ |
18 |
|
public class UDPReader extends Thread{ |
19 |
|
|
20 |
+ |
//---FINAL ATTRIBUTES--- |
21 |
+ |
|
22 |
+ |
/** |
23 |
+ |
* The current CVS revision of this class |
24 |
+ |
*/ |
25 |
+ |
public final String REVISION = "$Revision$"; |
26 |
+ |
|
27 |
+ |
//---STATIC METHODS--- |
28 |
+ |
|
29 |
+ |
//---CONSTRUCTORS--- |
30 |
+ |
|
31 |
|
// It is normal to use this constructor in preference |
32 |
|
// to any other in this class. |
33 |
|
public UDPReader(int port, Filter parent, Logger logger){ |
40 |
|
this(4589, parent, logger); |
41 |
|
} |
42 |
|
|
43 |
+ |
//---PUBLIC METHODS--- |
44 |
+ |
|
45 |
|
public void run() { |
46 |
|
|
47 |
|
DatagramSocket socket = null; |
80 |
|
} |
81 |
|
socket.close(); |
82 |
|
} |
83 |
< |
|
84 |
< |
|
83 |
> |
|
84 |
> |
/** |
85 |
> |
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
86 |
> |
* method to provide clean logging (every class should have this). |
87 |
> |
* |
88 |
> |
* @return the name of this class and its CVS revision |
89 |
> |
*/ |
90 |
> |
public String toString() { |
91 |
> |
return this.getClass().getName() + "(" + REVISION.substring(11, REVISION.length() - 2) + ")"; |
92 |
> |
} |
93 |
> |
|
94 |
> |
//---PRIVATE METHODS--- |
95 |
> |
|
96 |
> |
//---ACCESSOR/MUTATOR METHODS--- |
97 |
> |
|
98 |
> |
//---ATTRIBUTES--- |
99 |
> |
|
100 |
|
Logger logger; |
101 |
|
int port; |
102 |
|
Filter parent; |
103 |
|
|
104 |
|
final int packetSizeLimit = 8192; |
105 |
< |
|
105 |
> |
|
106 |
> |
//---STATIC ATTRIBUTES--- |
107 |
> |
|
108 |
|
} |