Java технологія. Основні риси та перспективи застосування
private static final String CRLF = "\r\n";
private String name = null;
private String id;
private boolean busy = false;
public ClientConnection(Server srv, Socket s, int i) {
try {
server = srv;
sock = s;
in = new DataInputStream(s.getInputStream());
out = s.getOutputStream();
host = s.getInetAddress().getHostName();
id = "" + i;
// tell the new one who it is...
write("id " + id + CRLF);
new Thread(this).start();
} catch (IOException e) {
System.out.println("failed ClientConnection " + e);
}
}
public String toString() {
return id + " " + host + " " + name;
}
public String getHost() {
return host;
}