1 |
ab11 |
1.1 |
import java.net.*; |
2 |
|
|
|
3 |
|
|
|
4 |
|
|
/** |
5 |
|
|
* LowLevelNet - Basic Netowking Class for Java Host <br><br> |
6 |
|
|
* Version 1.0 <br><br> |
7 |
|
|
* Version History: <br> |
8 |
|
|
* 16/11/00 1.0 Initial Version <br> |
9 |
|
|
* <br> |
10 |
|
|
* @author Ash Beeson <a href="mailto:ab11@ukc.ac.uk">ab11@ukc.ac.uk</a> |
11 |
|
|
*/ |
12 |
|
|
class LowLevelNet { |
13 |
|
|
|
14 |
|
|
/** |
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 |
|
|
} |
31 |
|
|
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
} |