package cec.net;

import java.io.*;
import java.net.*;

public class CECClientSocket {

	public static void main(String[] args) throws IOException {

		Socket kkSocket = null;
		PrintWriter out = null;
		BufferedReader in = null;

		try {
			kkSocket = new Socket("knowles.encs.concordia.ca", 4445);
			out = new PrintWriter(kkSocket.getOutputStream(), true);
			in = new BufferedReader(new InputStreamReader(
					kkSocket.getInputStream()));

		} catch (UnknownHostException e) {
			System.err.println("Don't know about host: taranis.");
			System.exit(1);
		} catch (IOException e) {
			System.err
					.println("Couldn't get I/O for the connection to: taranis.");
			System.exit(1);
		}

		BufferedReader stdIn = new BufferedReader(new InputStreamReader(
				System.in));
		String fromServer;
		String fromUser;

		// - Introduce ourselves to the server
		// out.println("register: deyvid.william@gmail.com");

		while ((fromUser = stdIn.readLine()) != null) {
			
			if (fromUser != null) {
				// System.out.println("Client: " + fromUser);
				out.println(fromUser);
			}
		}

		Cleanup.closeQuietly(out);
		Cleanup.closeQuietly(in);
		Cleanup.closeQuietly(stdIn);
		Cleanup.closeQuietly(kkSocket);

		/*
		 * out.close(); in.close(); stdIn.close(); kkSocket.close();
		 */
	}
}

@@ -161,19 +161,17 @@
 %09Socket 
-kkS
+s
 ocket = 
@@ -247,19 +247,17 @@
 y %7B%0D%0A%09%09%09
-kkS
+s
 ocket = 
@@ -273,14 +273,13 @@
 t(%22k
-nowles
+ocher
 .enc
@@ -328,19 +328,17 @@
 tWriter(
-kkS
+s
 ocket.ge
@@ -415,18 +415,9 @@
 der(
-%0D%0A%09%09%09%09%09kkS
+s
 ocke
@@ -763,22 +763,16 @@
 mReader(
-%0D%0A%09%09%09%09
 System.i
@@ -1212,19 +1212,17 @@
 Quietly(
-kkS
+s
 ocket);%0D

Clean up client socket