An interface defining some common API for both client and server sockets. Although a couple of methods are shared, it's rarely programmed against such interface in practice due to the fundamental behavioral difference between the two types of socket.
Type | Name | Signature |
---|---|---|
method | bind | public void bind(string, int) |
method | close | public void close() |
method | getLocalHost | public String getLocalHost() |
method | getLocalPort | public int getLocalPort() |
method | getSetting | public var getSetting(System.Network.TCPOption) |
method | getState | public SocketState getState() |
public void bind(string localHost, int localPort)
Bind this socket to a local address.
Parameters
public void close()
Close this socket. Once the socket is closed, all the streams from this socket will be closed too.
public String getLocalHost()
Get the local host. If the socket has not been bound, this returns null.
Returns
public int getLocalPort()
Get the local port. If the port has not been bound, this returns 0.
Returns
public var getSetting(TCPOption opt)
Get the setting for a particular option. Not all options are valid for a concrete Socket type. The value this returns for invalid options is undefined.
Parameters
Returns
public SocketState getState()
Query the state of this socket.
Returns