home *** CD-ROM | disk | FTP | other *** search
- package sun.net;
-
- import java.io.BufferedInputStream;
- import java.io.BufferedOutputStream;
- import java.io.IOException;
- import java.io.InputStream;
- import java.io.PrintStream;
- import java.net.Socket;
- import java.net.UnknownHostException;
-
- public class NetworkClient {
- protected Socket serverSocket;
- public PrintStream serverOutput;
- public InputStream serverInput;
-
- public void openServer(String var1, int var2) throws IOException, UnknownHostException {
- if (this.serverSocket != null) {
- this.closeServer();
- }
-
- this.serverSocket = this.doConnect(var1, var2);
- this.serverOutput = new PrintStream(new BufferedOutputStream(this.serverSocket.getOutputStream()), true);
- this.serverInput = new BufferedInputStream(this.serverSocket.getInputStream());
- }
-
- protected Socket doConnect(String var1, int var2) throws IOException, UnknownHostException {
- return new Socket(var1, var2);
- }
-
- public void closeServer() throws IOException {
- if (this.serverIsOpen()) {
- this.serverSocket.close();
- this.serverSocket = null;
- this.serverInput = null;
- this.serverOutput = null;
- }
- }
-
- public boolean serverIsOpen() {
- return this.serverSocket != null;
- }
-
- public NetworkClient(String var1, int var2) throws IOException {
- this.openServer(var1, var2);
- }
-
- public NetworkClient() {
- }
- }
-