| java.lang.Object | |
| ↳ | java.net.SocketImpl |
The abstract superclass of all classes that implement streaming sockets.
Streaming sockets are wrapped by two classes, ServerSocket and Socket at the
server and client end of a connection respectively. At the server there are
two types of sockets engaged in communication, the ServerSocket
on a well known port (hereafter refered to as the listener) used to establish
a connection and the resulting Socket (hereafter refered to as
host).
Some of the SocketImpl instance variable values must be
interpreted in the context of the wrapper. See the getter methods for these
details.
|
[Expand]
Inherited Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From interface
java.net.SocketOptions
| |||||||||||
| Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| address | |||||||||||
| fd | |||||||||||
| localport | |||||||||||
| port | |||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Construct a connection-oriented SocketImpl.
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Answer the nominated socket option.
| |||||||||||
Set the nominated socket option.
| |||||||||||
Returns a string containing a concise, human-readable description of the
socket.
| |||||||||||
| Protected Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Accepts a connection on the provided socket.
| |||||||||||
Answer the number of bytes that may be read from this socket without
blocking.
| |||||||||||
Binds this socket to the specified local host/port.
| |||||||||||
Close the socket.
| |||||||||||
Connect the socket to the host/port specified by the SocketAddress with a
specified timeout.
| |||||||||||
Connects this socket to the specified remote host address/port.
| |||||||||||
Connects this socket to the specified remote host/port.
| |||||||||||
Creates a new unconnected socket.
| |||||||||||
Answer the socket's file descriptor.
| |||||||||||
Answer the socket's address.
| |||||||||||
Answer the socket input stream.
| |||||||||||
Answer the socket's localport.
| |||||||||||
Answer the socket output stream.
| |||||||||||
Answer the socket's remote port.
| |||||||||||
Listen for connection requests on this stream socket.
| |||||||||||
Send the single byte of urgent data on the socket.
| |||||||||||
Sets performance preference for connectionTime, latency and bandwidth.
| |||||||||||
Shutdown the input portion of the socket.
| |||||||||||
Shutdown the output portion of the socket.
| |||||||||||
Answer if the socket supports urgent data.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
| |||||||||||
From interface java.net.SocketOptions
| |||||||||||
Construct a connection-oriented SocketImpl.
Answer the nominated socket option.
| optID | the socket option to retrieve |
|---|
| SocketException | thrown if an error occurs while accessing the option |
|---|
Set the nominated socket option.
| optID | the socket option to set |
|---|---|
| val | the option value |
| SocketException | thrown if an error occurs while setting the option |
|---|
Returns a string containing a concise, human-readable description of the socket.
Accepts a connection on the provided socket.
| newSocket | the socket to accept connections on |
|---|
| SocketException | if an error occurs while accepting |
|---|---|
| IOException |
Answer the number of bytes that may be read from this socket without blocking. This call does not block.
| SocketException | if an error occurs while peeking |
|---|---|
| IOException |
Binds this socket to the specified local host/port.
| address | the local machine address to bind the socket to |
|---|---|
| port | the port on the local machine to bind the socket to |
| IOException | if an error occurs while binding |
|---|
Close the socket. Usage thereafter is invalid.
| IOException | if an error occurs while closing |
|---|
Connect the socket to the host/port specified by the SocketAddress with a specified timeout.
| remoteAddr | the remote machine address and port to connect to |
|---|---|
| timeout | the millisecond timeout value, the connect will block indefinitely for a zero value. |
| IOException | if a problem occurs during the connect |
|---|
Connects this socket to the specified remote host address/port.
| address | the remote host address to connect to |
|---|---|
| port | the remote port to connect to |
| IOException | if an error occurs while connecting |
|---|
Connects this socket to the specified remote host/port.
| host | the remote host to connect to |
|---|---|
| port | the remote port to connect to |
| IOException | if an error occurs while connecting |
|---|
Creates a new unconnected socket. If streaming is true, create a stream socket, else a datagram socket.
| isStreaming | true, if the socket is type streaming |
|---|
| SocketException | if an error occurs while creating the socket |
|---|---|
| IOException |
Answer the socket's file descriptor.
Answer the socket's address. Refering to the class comment: Listener: The local machines IP address to which this socket is bound. Host: The client machine, to which this socket is connected. Client: The host machine, to which this socket is connected.
Answer the socket input stream.
| IOException | thrown if an error occurs while accessing the stream |
|---|
Answer the socket's localport. The field is initialized to -1 and upon demand will go to the IP stack to get the bound value. See the class comment for the context of the local port.
Answer the socket output stream.
| IOException | thrown if an error occurs while accessing the stream |
|---|
Answer the socket's remote port. This value is not meaningful when the socketImpl is wrapped by a ServerSocket.
Listen for connection requests on this stream socket. Incoming connection requests are queued, up to the limit nominated by backlog. Additional requests are rejected. listen() may only be invoked on stream sockets.
| backlog | the max number of outstanding connection requests |
|---|
| IOException | thrown if an error occurs while listening |
|---|
Send the single byte of urgent data on the socket.
| value | the byte of urgent data |
|---|
| IOException | when an error occurs sending urgent data |
|---|
Sets performance preference for connectionTime, latency and bandwidth. Does nothing by default.
| connectionTime | the importance of connect time |
|---|---|
| latency | the importance of latency |
| bandwidth | the importance of bandwidth |
Shutdown the input portion of the socket. The default implementation always throws an IOException to indicate that the subclass should have overridden this method.
| IOException | Always. Designed to be subclassed. |
|---|
Shutdown the output portion of the socket. The default implementation always throws an IOException to indicate that the subclass should have overridden this method.
| IOException | Always. Designed to be subclassed. |
|---|
Answer if the socket supports urgent data. Subclasses should override this method.