Cryptography Reference
In-Depth Information
public void windowClosing(WindowEvent e) {
System.exit(0);
}
}
);
server = new ServerSocket(55555);
ccs.go();
server.close();
}
}
The client side of the chat program is pretty much the same, except it must initiate the
connection with the server. Either the client or the server can break the connection, but the
client must reinitiate, if desired. Figure 15.2 shows a screen shot of the client.
It contains an area to type in the name of the server to connect to, and a button to con-
nect. This button changes appearance once a connection exists; the label changes to “Dis-
connect from server above.” The client also contains a field to type messages in, and an
output area for incoming messages, and connection information.
import java.io.*;
import java.net.*;
FIGURE 15.2
Search WWH ::




Custom Search