|
|
@ -3,6 +3,7 @@ package ru.molokoin; |
|
|
|
import java.io.BufferedReader; |
|
|
|
import java.io.BufferedReader; |
|
|
|
import java.io.BufferedWriter; |
|
|
|
import java.io.BufferedWriter; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
import java.io.InputStream; |
|
|
|
import java.io.InputStreamReader; |
|
|
|
import java.io.InputStreamReader; |
|
|
|
import java.io.OutputStreamWriter; |
|
|
|
import java.io.OutputStreamWriter; |
|
|
|
import java.net.Socket; |
|
|
|
import java.net.Socket; |
|
|
@ -13,13 +14,15 @@ import java.util.Date; |
|
|
|
* - Подключение вынесено в отдельный поток, чтобы обеспечить возможность подключения к серверу множества клиентов |
|
|
|
* - Подключение вынесено в отдельный поток, чтобы обеспечить возможность подключения к серверу множества клиентов |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class Connection extends Thread{ |
|
|
|
public class Connection extends Thread{ |
|
|
|
public BufferedReader in; |
|
|
|
//public BufferedReader in;
|
|
|
|
|
|
|
|
public InputStream in; |
|
|
|
public BufferedWriter out; |
|
|
|
public BufferedWriter out; |
|
|
|
//public BufferedReader console;
|
|
|
|
//public BufferedReader console;
|
|
|
|
|
|
|
|
|
|
|
|
public Connection(Socket socket) throws IOException{ |
|
|
|
public Connection(Socket socket) throws IOException{ |
|
|
|
System.out.println("Соединение с клиентом установлено ..."); |
|
|
|
System.out.println("Соединение с клиентом установлено ..."); |
|
|
|
in = new BufferedReader(new InputStreamReader(socket.getInputStream())); |
|
|
|
//in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
|
|
|
|
|
|
|
|
in = socket.getInputStream(); |
|
|
|
out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); |
|
|
|
out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); |
|
|
|
//console = new BufferedReader(new InputStreamReader(System.in));
|
|
|
|
//console = new BufferedReader(new InputStreamReader(System.in));
|
|
|
|
Thread threadConn = new Thread(this); |
|
|
|
Thread threadConn = new Thread(this); |
|
|
|