diff options
author | Dor Bivas <dor1_b@walla.com> | 2014-01-18 14:52:09 +0200 |
---|---|---|
committer | Dor Bivas <dor1_b@walla.com> | 2014-01-18 14:59:23 +0200 |
commit | e0bb3dd9dc74c6b0fb8a51c2d2afb398c00768ce (patch) | |
tree | 839f689dd96e38ac3768a3fe8e6f68b1bfe871e4 /src/Server/Connection.java | |
parent | 2abe19f0946d571a784b93d66a54d5c686313aa5 (diff) |
server: Client now know connection
* Client.Disconnect is now using Connection.shutdown command.
* Connection knows now client and vice versa.
Diffstat (limited to 'src/Server/Connection.java')
-rw-r--r-- | src/Server/Connection.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Server/Connection.java b/src/Server/Connection.java index 62afa9a..92869f1 100644 --- a/src/Server/Connection.java +++ b/src/Server/Connection.java @@ -11,7 +11,6 @@ class ParsedLine private String line; private String command; private String args; - public ParsedLine(String line) { @@ -42,18 +41,20 @@ class ParsedLine public class Connection extends Thread { private Socket soc; + private Client client; public Connection(Socket soc) { this.soc = soc; } - private void shutdown() + public void shutdown() { try { if (!soc.isClosed()) soc.close(); + } catch (IOException e) {} } @@ -67,13 +68,12 @@ public class Connection extends Thread { try { - Client client; CommandsTable commandsTable = new CommandsTable(); DataInputStream input = new DataInputStream(soc.getInputStream()); OutputStreamWriter outTemp = new OutputStreamWriter(soc.getOutputStream()); BufferedWriter output = new BufferedWriter(outTemp); - client = new Client(soc, output); + client = new Client(soc, output, this); while (true) { |