ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/host/java/LowLevelNet.java
Revision: 1.5
Committed: Wed Jan 24 01:25:59 2001 UTC (23 years, 8 months ago) by tdb
Branch: MAIN
CVS Tags: PROJECT_COMPLETION
Changes since 1.4: +4 -4 lines
Log Message:
Just a few minor formatting issues. I don't think we need it to blurt the UDP
packet out all the time... :)
Also changed "Sending UDP Packet" to "." and "Sending Heartbeat" to "+", with no
println, just print. Looks much neater.

File Contents

# User Rev Content
1 ab11 1.2 //---PACKAGE DECLARATION---
2    
3     //---IMPORTS---
4    
5 ab11 1.1 import java.net.*;
6 ab11 1.3 import java.io.*;
7 ab11 1.1
8     /**
9 ab11 1.2 * Provides low level network functions for JavaHost
10     * <DETAILED DESCRIPTION>
11     *
12 tdb 1.5 * @author $Author: tdb1 $
13     * @version $Id: LowLevelNet.java,v 1.4 2000/12/07 23:20:35 tdb1 Exp $
14 ab11 1.2 */
15 ab11 1.1 class LowLevelNet {
16    
17 ab11 1.2 //---FINAL ATTRIBUTES---
18    
19     //---STATIC METHODS---
20    
21     /**
22     * sendUDPPacket - will attempt to send a UDP packet containing 'inText' to server
23     * on the specificed port.
24     */
25     public static void sendUDPPacket( Config config, String inText ){
26    
27     if ( inText.length() != 0 ){
28 tdb 1.5 //System.out.println("SENT: "+inText);
29 ab11 1.2 // will throw an exception if an error occurs, so must bung it in a try
30 ab11 1.3 try {
31 ab11 1.2 DatagramPacket udp = new DatagramPacket( inText.getBytes(), inText.length(), config.getFilterName(), config.getFilterUDPPort() );
32 ab11 1.3 DatagramSocket sendSoc = new DatagramSocket();
33     sendSoc.send(udp);
34     }
35     catch ( SocketException e ){
36     // the serverName supplied could not be resolved using dns
37     }
38     catch ( IOException e ){
39     // problem sending..
40     }
41 ab11 1.2 }
42     }
43    
44     //---CONSTRUCTORS---
45    
46     //---PUBLIC METHODS---
47    
48     //---PRIVATE METHODS---
49    
50     //---ACCESSOR/MUTATOR METHODS---
51    
52     //---ATTRIBUTES---
53 ab11 1.1
54 ab11 1.2 //---STATIC ATTRIBUTES---
55 ab11 1.1
56 tdb 1.5 }