1 |
< |
import java.net.*; |
1 |
> |
//---PACKAGE DECLARATION--- |
2 |
|
|
3 |
+ |
//---IMPORTS--- |
4 |
|
|
5 |
+ |
import java.net.*; |
6 |
+ |
|
7 |
|
/** |
8 |
< |
* LowLevelNet - Basic Netowking Class for Java Host <br><br> |
9 |
< |
* Version 1.0 <br><br> |
10 |
< |
* Version History: <br> |
11 |
< |
* 16/11/00 1.0 Initial Version <br> |
12 |
< |
* <br> |
13 |
< |
* @author Ash Beeson <a href="mailto:ab11@ukc.ac.uk">ab11@ukc.ac.uk</a> |
11 |
< |
*/ |
8 |
> |
* Provides low level network functions for JavaHost |
9 |
> |
* <DETAILED DESCRIPTION> |
10 |
> |
* |
11 |
> |
* @author $Author$ |
12 |
> |
* @version $Id$ |
13 |
> |
*/ |
14 |
|
class LowLevelNet { |
15 |
|
|
16 |
< |
/** |
15 |
< |
* sendUDPPacket - will attempt to send a UDP packet containing 'inText' to server |
16 |
< |
* on the specificed port. |
17 |
< |
*/ |
18 |
< |
public static void sendUDPPacket( Config config, String inText ){ |
19 |
< |
|
20 |
< |
if ( inText.length() != 0 ){ |
21 |
< |
|
22 |
< |
// will throw an exception if an error occurs, so must bung it in a try |
23 |
< |
// try { |
24 |
< |
DatagramPacket udp = new DatagramPacket( inText.getBytes(), inText.length(), config.getFilterName(), config.getFilterUDPPort() ); |
25 |
< |
// } |
26 |
< |
//catch ( UnknownHostException e ){ |
27 |
< |
// the serverName supplied could not be resolved using dns |
28 |
< |
// } |
29 |
< |
} |
30 |
< |
} |
16 |
> |
//---FINAL ATTRIBUTES--- |
17 |
|
|
18 |
< |
|
18 |
> |
//---STATIC METHODS--- |
19 |
> |
|
20 |
> |
/** |
21 |
> |
* sendUDPPacket - will attempt to send a UDP packet containing 'inText' to server |
22 |
> |
* on the specificed port. |
23 |
> |
*/ |
24 |
> |
public static void sendUDPPacket( Config config, String inText ){ |
25 |
> |
|
26 |
> |
if ( inText.length() != 0 ){ |
27 |
> |
|
28 |
> |
// will throw an exception if an error occurs, so must bung it in a try |
29 |
> |
// try { |
30 |
> |
DatagramPacket udp = new DatagramPacket( inText.getBytes(), inText.length(), config.getFilterName(), config.getFilterUDPPort() ); |
31 |
> |
// } |
32 |
> |
//catch ( UnknownHostException e ){ |
33 |
> |
// the serverName supplied could not be resolved using dns |
34 |
> |
// } |
35 |
> |
} |
36 |
> |
} |
37 |
> |
|
38 |
> |
//---CONSTRUCTORS--- |
39 |
> |
|
40 |
> |
//---PUBLIC METHODS--- |
41 |
> |
|
42 |
> |
//---PRIVATE METHODS--- |
43 |
> |
|
44 |
> |
//---ACCESSOR/MUTATOR METHODS--- |
45 |
> |
|
46 |
> |
//---ATTRIBUTES--- |
47 |
> |
|
48 |
> |
//---STATIC ATTRIBUTES--- |
49 |
|
|
50 |
|
} |