public class

NetworkClient

extends Object
java.lang.Object
   ↳ sun.net.NetworkClient
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

This is the base class for network clients.

Summary

Fields
protected int connectTimeout
protected static int defaultConnectTimeout
protected static int defaultSoTimeout
protected static String encoding
protected Proxy proxy
protected int readTimeout
public InputStream serverInput Buffered stream for reading replies from server.
public PrintStream serverOutput Stream for printing to the server.
protected Socket serverSocket Socket for communicating with server.
Public Constructors
NetworkClient(String host, int port)
Create connection with host host on port port
NetworkClient()
Public Methods
void closeServer()
Close an open connection to the server.
int getConnectTimeout()
int getReadTimeout()
void openServer(String server, int port)
Open a connection to the server.
boolean serverIsOpen()
Return server connection status
void setConnectTimeout(int timeout)
void setReadTimeout(int timeout)
Protected Methods
Socket createSocket()
The following method, createSocket, is provided to allow the https client to override it so that it may use its socket factory to create the socket.
Socket doConnect(String server, int port)
Return a socket connected to the server, with any appropriate options pre-established
InetAddress getLocalAddress()
[Expand]
Inherited Methods
From class java.lang.Object

Fields

protected int connectTimeout

protected static int defaultConnectTimeout

protected static int defaultSoTimeout

protected static String encoding

protected Proxy proxy

protected int readTimeout

public InputStream serverInput

Buffered stream for reading replies from server.

public PrintStream serverOutput

Stream for printing to the server.

protected Socket serverSocket

Socket for communicating with server.

Public Constructors

public NetworkClient (String host, int port)

Create connection with host host on port port

Throws
IOException

public NetworkClient ()

Public Methods

public void closeServer ()

Close an open connection to the server.

Throws
IOException

public int getConnectTimeout ()

public int getReadTimeout ()

public void openServer (String server, int port)

Open a connection to the server.

public boolean serverIsOpen ()

Return server connection status

public void setConnectTimeout (int timeout)

public void setReadTimeout (int timeout)

Protected Methods

protected Socket createSocket ()

The following method, createSocket, is provided to allow the https client to override it so that it may use its socket factory to create the socket.

Throws
IOException

protected Socket doConnect (String server, int port)

Return a socket connected to the server, with any appropriate options pre-established

protected InetAddress getLocalAddress ()

Throws
IOException