/* CS 1520 Summer 2011 Simple client that will send messages to a server. The server is determined using a COMMAND-LINE argument, which is simply additional information provided when the java interpreter is run. The command line is of the following format: java ISend So that the message is parsed correctly, it should be put in double quotes. */ import java.net.*; import java.io.*; public class ISend { static final int port = 8800; public static void main( String [] args) { try { if (args.length < 3) System.out.println("Not enough arguments...quitting"); else { InetAddress addr = InetAddress.getByName(args[0]); Socket socket = new Socket(addr, port); PrintWriter output = new PrintWriter( new BufferedWriter( new OutputStreamWriter( socket.getOutputStream())), true); String sendLine = args[1] + ": " + args[2]; output.println(sendLine); } } catch( Exception e) { System.out.println("Problem with connection" + e); } } }