import java.net.Socket;
import java.io.PrintStream;
import java.io.IOException;

/**
 * Hugo client written in Java by Dimitrios Vlastaras (dt06dv0)
 * mail [at] dimme (dot) net
 *
 * 2007-06-08: Minor refactoring by DWWW.
 */
public class Hugo {
	public static void main(String[] args) {
		if (args.length != 0) {
			String text = "";
			for(int i = 0; i < args.length; i++)
				text += (i > 0 ? " " : "") + args[i];
			try {
				Socket connection = new Socket("hugo.dsek.lth.se", 1101); 
				PrintStream out = new PrintStream(connection.getOutputStream());
				out.println(text);
				out.close();
				connection.close();
				System.out.println("Message sent to Hugo: " + text);
			} catch (IOException e) {
				System.err.println("Could not connect to Hugo..."); 
			}
		} else {
			System.out.println("Usage: Hugo <message>");
		}
	}
}

