// ServerConnection.java -- server-side socket connection // // author : Scott W. Matey // import java.net.*; import java.io.*; // There isn't supposed to be any need for specific servers to subclass // this to create custom connection classes. Use the Server protocol. // Servers can stuff additional attributes inside the "info" slot instead // of subclassing this to add more slots. public class ServerConnection extends Connection { Server server; public Object info = null; // slot for server-specific attributes ServerConnection (Server p, Socket s) { super (s); server = p; if (server.readHandshake (this)) { server.connect (this); listen (); } else close (); } public void notifyInput (String s) { server.notifyInput (s); } public void run () { super.run (); server.disconnect (this); } }