summaryrefslogtreecommitdiff
path: root/src/Server/Client.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/Server/Client.java')
-rw-r--r--src/Server/Client.java48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/Server/Client.java b/src/Server/Client.java
new file mode 100644
index 0000000..f8cc503
--- /dev/null
+++ b/src/Server/Client.java
@@ -0,0 +1,48 @@
+package Server;
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.net.Socket;
+
+public class Client
+{
+ String nick;
+ Socket soc;
+ BufferedWriter output;
+
+ public Client(Socket soc, BufferedWriter output)
+ {
+ this.soc = soc;
+ this.output = output;
+ }
+
+ public String getNick()
+ {
+ return this.nick;
+ }
+
+ public void setNick(String newNick)
+ {
+ this.nick = newNick;
+ }
+
+
+ public void disconect ()
+ {
+ try {
+ this.soc.close();
+ }
+ catch (IOException e)
+ {
+ System.err.println("The socket failed to closed: " + e);
+ }
+
+ }
+
+
+ public void println(String line) throws IOException
+ {
+ output.write(line, 0, line.length());
+ output.newLine();
+ output.flush();
+ }
+}