--- projects/cms/source/host/java/LowLevelNet.java 2000/11/27 20:36:24 1.2 +++ projects/cms/source/host/java/LowLevelNet.java 2002/05/21 16:47:12 1.7 @@ -1,15 +1,36 @@ +/* + * i-scream central monitoring system + * http://www.i-scream.org.uk + * Copyright (C) 2000-2002 i-scream + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + //---PACKAGE DECLARATION--- //---IMPORTS--- import java.net.*; +import java.io.*; /** * Provides low level network functions for JavaHost * * - * @author $Author: ab11 $ - * @version $Id: LowLevelNet.java,v 1.2 2000/11/27 20:36:24 ab11 Exp $ + * @author $Author: tdb $ + * @version $Id: LowLevelNet.java,v 1.7 2002/05/21 16:47:12 tdb Exp $ */ class LowLevelNet { @@ -24,14 +45,19 @@ class LowLevelNet { public static void sendUDPPacket( Config config, String inText ){ if ( inText.length() != 0 ){ - + //System.out.println("SENT: "+inText); // will throw an exception if an error occurs, so must bung it in a try - // try { + try { DatagramPacket udp = new DatagramPacket( inText.getBytes(), inText.length(), config.getFilterName(), config.getFilterUDPPort() ); - // } - //catch ( UnknownHostException e ){ - // the serverName supplied could not be resolved using dns - // } + DatagramSocket sendSoc = new DatagramSocket(); + sendSoc.send(udp); + } + catch ( SocketException e ){ + // the serverName supplied could not be resolved using dns + } + catch ( IOException e ){ + // problem sending.. + } } } @@ -47,4 +73,4 @@ class LowLevelNet { //---STATIC ATTRIBUTES--- -} \ No newline at end of file +}