Java технологія. Основні риси та перспективи застосування
клас ServerConnection:
import java.io.*;
import java.net.*;
import java.util.*;
class ServerConnection implements Runnable {
void sendTo(String s, String id)
{
if( id!= null )
out.println("to "+id+" "+s);
}
private static final int port = 6564;
private static final String CRLF = "\r\n";
private DataInputStream in;
private PrintStream out;
private String id, toid = null;
private Client client;
public ServerConnection(Scrabblet sc, String site) throws IOException {
Socket server = new Socket(site, port);
in = new DataInputStream(server.getInputStream());
out = new PrintStream(server.getOutputStream(), true);
}
public ServerConnection( Client c,String site) throws IOException {
client = c;
Socket server = new Socket(site, port);
in = new DataInputStream(server.getInputStream());