ice.net
Class ClientSocket

java.lang.Object
  extended byice.net.ClientSocket
All Implemented Interfaces:
SimpleSocket

public class ClientSocket
extends Object
implements SimpleSocket

Version:
1.5.2
Author:
Jack van Ooststroom

Constructor Summary
ClientSocket(InetAddress inetAddress, int port)
          A wrapper constructor for Socket.Socket(InetAddress, int).
ClientSocket(InetAddress inetAddress, int port, boolean stream)
          Deprecated. As of 1.5.2, use DatagramSocket instead for UDP transport.
ClientSocket(InetAddress inetAddress, int port, InetAddress localInetAddress, int localPort)
          A wrapper constructor for Socket.Socket(InetAddress, int, InetAddress, int).
ClientSocket(Socket socket)
           
ClientSocket(String host, int port)
          A wrapper constructor for Socket.Socket(String, int).
ClientSocket(String host, int port, boolean stream)
          Deprecated. As of 1.5.2, use DatagramSocket instead for UDP transport.
ClientSocket(String host, int port, InetAddress localInetAddress, int localPort)
          A wrapper constructor for Socket.Socket(String, int, InetAddress, int).
 
Method Summary
 void close()
          A wrapper method for Socket.close().
 InetAddress getInetAddress()
          A wrapper method for Socket.getInetAddress().
 InputStream getInputStream()
          A wrapper method for Socket.getInputStream().
 boolean getKeepAlive()
          A wrapper method for Socket.getKeepAlive().
 InetAddress getLocalAddress()
          A wrapper method for Socket.getLocalAddress().
 int getLocalPort()
          A wrapper method for Socket.getLocalPort().
 OutputStream getOutputStream()
          A wrapper method for Socket.getOutputStream().
 int getPort()
          A wrapper method for Socket.getPort().
 int getReceiveBufferSize()
          A wrapper method for Socket.getReceiveBufferSize().
 int getSendBufferSize()
          A wrapper method for Socket.getSendBufferSize().
 int getSoLinger()
          A wrapper method for Socket.getSoLinger().
 int getSoTimeout()
          A wrapper method for Socket.getSoTimeout().
 boolean getTcpNoDelay()
          A wrapper method for Socket.getTcpNoDelay().
 void setKeepAlive(boolean on)
          A wrapper method for Socket.setKeepAlive(boolean).
 void setReceiveBufferSize(int size)
          A wrapper method for Socket.setReceiveBufferSize(int).
 void setSendBufferSize(int size)
          A wrapper method for Socket.setSendBufferSize(int).
 void setSoLinger(boolean on, int linger)
          A wrapper method for Socket.setSoLinger(boolean, int).
 void setSoTimeout(int timeout)
          A wrapper method for Socket.setSoTimeout(int).
 void setTcpNoDelay(boolean on)
          A wrapper method for Socket.setTcpNoDelay(boolean).
 void shutdownInput()
          A wrapper method for Socket.shutdownInput().
 void shutdownOutput()
          A wrapper method for Socket.shutdownOutput().
 boolean useIp()
          Checks to see if the SimpleSocket needs to use the IP (Internet Protocol).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientSocket

public ClientSocket(InetAddress inetAddress,
                    int port)
             throws IOException,
                    SecurityException

A wrapper constructor for Socket.Socket(InetAddress, int).

Since:
1.5.2
See Also:
Socket.Socket(InetAddress, int)

ClientSocket

public ClientSocket(InetAddress inetAddress,
                    int port,
                    boolean stream)
             throws IOException,
                    SecurityException
Deprecated. As of 1.5.2, use DatagramSocket instead for UDP transport.

A wrapper constructor for Socket.Socket(InetAddress, int, boolean).

Since:
1.5.2
See Also:
Socket.Socket(InetAddress, int, boolean)

ClientSocket

public ClientSocket(InetAddress inetAddress,
                    int port,
                    InetAddress localInetAddress,
                    int localPort)
             throws IOException,
                    SecurityException

A wrapper constructor for Socket.Socket(InetAddress, int, InetAddress, int).

Since:
1.5.2
See Also:
Socket.Socket(InetAddress, int, InetAddress, int)

ClientSocket

public ClientSocket(String host,
                    int port)
             throws IOException,
                    SecurityException,
                    UnknownHostException

A wrapper constructor for Socket.Socket(String, int).

Since:
1.5.2
See Also:
Socket.Socket(String, int)

ClientSocket

public ClientSocket(String host,
                    int port,
                    boolean stream)
             throws IOException,
                    SecurityException,
                    UnknownHostException
Deprecated. As of 1.5.2, use DatagramSocket instead for UDP transport.

A wrapper constructor for Socket.Socket(String, int, boolean).

Since:
1.5.2
See Also:
Socket.Socket(String, int, boolean)

ClientSocket

public ClientSocket(String host,
                    int port,
                    InetAddress localInetAddress,
                    int localPort)
             throws IOException,
                    SecurityException,
                    UnknownHostException

A wrapper constructor for Socket.Socket(String, int, InetAddress, int).

Since:
1.5.2
See Also:
Socket.Socket(String, int, InetAddress, int)

ClientSocket

public ClientSocket(Socket socket)
             throws IllegalArgumentException
Method Detail

close

public void close()
           throws IOException

A wrapper method for Socket.close().

Specified by:
close in interface SimpleSocket
Throws:
IOException - if an I/O error occurs when closing the SimpleSocket.
Since:
1.5.2
See Also:
Socket.close()

getInetAddress

public InetAddress getInetAddress()

A wrapper method for Socket.getInetAddress().

Specified by:
getInetAddress in interface SimpleSocket
Returns:
the remote IP address.
Since:
1.5.2
See Also:
Socket.getInetAddress()

getInputStream

public InputStream getInputStream()
                           throws IOException

A wrapper method for Socket.getInputStream().

Specified by:
getInputStream in interface SimpleSocket
Returns:
the input stream.
Throws:
IOException - if an I/O error occurs when creating the input stream or the SimpleSocket is closed.
Since:
1.5.2
See Also:
Socket.getInputStream()

getKeepAlive

public boolean getKeepAlive()
                     throws SocketException

A wrapper method for Socket.getKeepAlive().

Throws:
SocketException
Since:
1.5.2
See Also:
Socket.getKeepAlive()

getLocalAddress

public InetAddress getLocalAddress()

A wrapper method for Socket.getLocalAddress().

Since:
1.5.2
See Also:
Socket.getLocalAddress()

getLocalPort

public int getLocalPort()

A wrapper method for Socket.getLocalPort().

Since:
1.5.2
See Also:
Socket.getLocalPort()

getOutputStream

public OutputStream getOutputStream()
                             throws IOException

A wrapper method for Socket.getOutputStream().

Specified by:
getOutputStream in interface SimpleSocket
Returns:
the output stream.
Throws:
IOException - if an I/O error occurs when creating the output stream or the SimpleSocket is closed.
Since:
1.5.2
See Also:
Socket.getOutputStream()

getPort

public int getPort()

A wrapper method for Socket.getPort().

Specified by:
getPort in interface SimpleSocket
Returns:
the remote port.
Since:
1.5.2
See Also:
Socket.getPort()

getReceiveBufferSize

public int getReceiveBufferSize()
                         throws SocketException

A wrapper method for Socket.getReceiveBufferSize().

Throws:
SocketException
Since:
1.5.2
See Also:
Socket.getReceiveBufferSize()

getSendBufferSize

public int getSendBufferSize()
                      throws SocketException

A wrapper method for Socket.getSendBufferSize().

Throws:
SocketException
Since:
1.5.2
See Also:
Socket.getSendBufferSize()

getSoLinger

public int getSoLinger()
                throws SocketException

A wrapper method for Socket.getSoLinger().

Throws:
SocketException
Since:
1.5.2
See Also:
Socket.getSoLinger()

getSoTimeout

public int getSoTimeout()
                 throws SocketException

A wrapper method for Socket.getSoTimeout().

Specified by:
getSoTimeout in interface SimpleSocket
Returns:
the SO_TIMEOUT int value.
Throws:
SocketException - if there is an error in the underlying protocol, such as a TCP error.
Since:
1.5.2
See Also:
Socket.getSoTimeout()

getTcpNoDelay

public boolean getTcpNoDelay()
                      throws SocketException

A wrapper method for Socket.getTcpNoDelay().

Specified by:
getTcpNoDelay in interface SimpleSocket
Returns:
true if TCP_NODELAY is enabled, false if not.
Throws:
SocketException - if there is an error in the underlying protocol, such as a TCP error.
Since:
1.5.2
See Also:
Socket.getTcpNoDelay()

setKeepAlive

public void setKeepAlive(boolean on)
                  throws SocketException

A wrapper method for Socket.setKeepAlive(boolean).

Throws:
SocketException
Since:
1.5.2
See Also:
Socket.setKeepAlive(boolean)

setReceiveBufferSize

public void setReceiveBufferSize(int size)
                          throws IllegalArgumentException,
                                 SocketException

A wrapper method for Socket.setReceiveBufferSize(int).

Throws:
IllegalArgumentException
SocketException
Since:
1.5.2
See Also:
Socket.setReceiveBufferSize(int)

setSendBufferSize

public void setSendBufferSize(int size)
                       throws IllegalArgumentException,
                              SocketException

A wrapper method for Socket.setSendBufferSize(int).

Throws:
IllegalArgumentException
SocketException
Since:
1.5.2
See Also:
Socket.setSendBufferSize(int)

setSoLinger

public void setSoLinger(boolean on,
                        int linger)
                 throws IllegalArgumentException,
                        SocketException

A wrapper method for Socket.setSoLinger(boolean, int).

Throws:
IllegalArgumentException
SocketException
Since:
1.5.2
See Also:
Socket.setSoLinger(boolean, int)

setSoTimeout

public void setSoTimeout(int timeout)
                  throws IllegalArgumentException,
                         SocketException

A wrapper method for Socket.setSoTimeout(int).

Specified by:
setSoTimeout in interface SimpleSocket
Parameters:
timeout - the new timeout in milliseconds.
Throws:
SocketException - if there is an error in the underlying protocol, such as a TCP error.
IllegalArgumentException - if the specified timeout is lesser than 0.
Since:
1.5.2
See Also:
Socket.setSoTimeout(int)

setTcpNoDelay

public void setTcpNoDelay(boolean on)
                   throws SocketException

A wrapper method for Socket.setTcpNoDelay(boolean).

Specified by:
setTcpNoDelay in interface SimpleSocket
Parameters:
on - true to enable TCP_NODELAY, false to disable.
Throws:
SocketException - if there is an error in the underlying protocol, such as a TCP error.
Since:
1.5.2
See Also:
Socket.setTcpNoDelay(boolean)

shutdownInput

public void shutdownInput()
                   throws IOException

A wrapper method for Socket.shutdownInput().

Throws:
IOException
Since:
1.5.2
See Also:
Socket.shutdownInput()

shutdownOutput

public void shutdownOutput()
                    throws IOException

A wrapper method for Socket.shutdownOutput().

Throws:
IOException
Since:
1.5.2
See Also:
Socket.shutdownOutput()

useIp

public boolean useIp()
Description copied from interface: SimpleSocket

Checks to see if the SimpleSocket needs to use the IP (Internet Protocol).

Specified by:
useIp in interface SimpleSocket
Returns:
true if the SimpleSocket needs to use the IP, false if not.