public static void main(String[] args) {
		if (args.length != 2) {
			System.err.println("Arguments: <server> <port>");
			return;
		}
		
		try {
			server = args[0];
			port = Integer.parseInt(args[1]);
			
			if (port < 0 || port > 65535) {
				throw new NumberFormatException();
			}
			
			socket = new Socket(server, port);
			
			System.out.println(getDate() + " Client connected to " + server + " on port " + port + ".");
			
			Thread receiverThread = new Thread(new Receiver());
			receiverThread.setDaemon(true);
			receiverThread.start();
			
			transmit();
			
		} catch (NumberFormatException e) {
			System.err.println("Arguments: <server> <port>");
			return;
		} catch (IOException e) {
			System.err.println("Cannot connect to " + server + " on port " + port + ".");
			return;
		} finally {
			try {
				socket.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}