// ClientApplet.java -- generic network client applet // // author : Scott W. Matey // import java.awt.*; import java.applet.*; import java.io.*; import java.net.*; public class ClientApplet extends Applet { ClientConnection conn; static final String HOST = "cs.millersv.edu"; static final int PORT = 5050; // a random number? // init & destroy methods public void init () { String hoststring = getParameter ("host"); String portstring = getParameter ("port"); try { String host = ((hoststring == null) ? HOST : hoststring); int port = ((portstring == null) ? PORT : Integer.parseInt (portstring)); conn = new ClientConnection (this, host, port); } catch (Exception e); } public void destroy () { close (); super.destroy (); } public void close () { if (conn != null) { conn.close (); conn = null; } } // override these methods in subclasses public void notifyInput (String s) { } public void sendHandshake () { } }