Libraries anvil net Socket

class Socket
extends anvil.lang.object
Client socket (also called just "socket"). A socket is an endpoint for communication between two machines.

Constructor
Socket(string remoteAddr, int remotePort)
Socket(InetAddress remoteAddr, int remotePort)
Socket(InetAddress remoteAddr, int remotePort, InetAddress localAddr, int localPort)
Socket(string remoteAddr, int remotePort, string localAddr, int localPort)
Socket(InetAddress remoteAddr, int remotePort, string localAddr, int localPort)
Socket(string remoteAddr, int remotePort, string localAddr, int localPort)
Creates a new socket to given remoteAddr and remotePort. Socket is bound locally either to default address and random port or given localAddr and localPort.
Throws IOError -  if an IO error occured


Methods

void close()
Closes this socket.
Throws IOError -  If an IO error occured

InetAddress getAddress()
Returns the remote IP address to which this socket has been bound to.
Returns remote address

InputStream getInput()
Gets the input stream of this socket.
Throws IOError -  If an IO error occured

InetAddress getLocalAddress()
Returns the local IP address to which this socket has been bound to.
Returns local address

int getLocalPort()
Returns the local port to which this socket has been bound to.
Returns port

OutputStream getOutput()
Gets the output stream of this socket.
Throws IOError -  If an IO error occured

int getPort()
Returns the remote port to which this socket has been bound to.
Returns remote port

int getReceiveBufferSize()
A datagram socket option.
Returns buffer size
Throws SocketError -  If an error occured

int getSendBufferSize()
A datagram socket option.
Returns buffer size
Throws SocketError -  If an error occured

int getSoLinger()
Returns setting for SO_LINGER.
Returns SO_LINGER, -1 implies that the option is disabled.
Throws SocketError -  If an error occured

int getSoTimeout()
Returns the setting for SO_TIMEOUT, in milliseconds.
Returns SO_TIMEOUT, 0 implies that the option is disabled (i.e., timeout of infinity).
Throws SocketError -  If an error occured

boolean getTcpNoDelay()
Returns the value of TCP_NODELAY option.
Throws SocketError -  If an error occured

void setReceiveBufferSize(int bufferSize)
A datagram socket option.
Throws SocketError -  If an error occured

void setSendBufferSize(int bufferSize)
A datagram socket option.
Throws SocketError -  If an error occured

boolean setSoLinger(boolean on, int linger)
Enable/disable SO_LINGER with the specified linger time in seconds. If the specified timeout value exceeds 65,535 it will be reduced to 65,535.
Throws SocketError -  If an error occured

boolean setSoTimeout(int timeout)
Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds. With this option set to a non-zero timeout, a read() call on the InputStream associated with this Socket will block for only this amount of time. If the timeout expires, a read operation is interrupted , though the Socket is still valid. The option must be enabled prior to entering the blocking operation to have effect. The timeout must be > 0. A timeout of zero is interpreted as an infinite timeout.
Throws SocketError -  If an error occured

boolean setTcpNoDelay(boolean on)
Enable/disable TCP_NODELAY (disable/enable Nagle's algorithm).
Throws SocketError -  If an error occured