java.net.SocketImpl
java.lang.Object
None
None
JDK 1.0 or later
The SocketImpl class is an abstract class that defines the bulk of the methods that make the Socket and ServerSocket classes work. Thus, SocketImpl is used to create both client and server sockets. Non-public subclasses of SocketImpl provide platform-specific implementations of stream-based socket communication. A plain socket implements the methods in SocketImpl as described; other implementations could provide socket communication through a proxy or firewall.
public abstract class java.net.SocketImpl extends java.lang.Object { // Variables protected InetAddress address; protected FileDescriptor fd; protected int localport; protected int port; // Instance Methods public String toString(); // Protected Instance Methods protected abstract void accept(SocketImpl s); protected abstract int available(); protected abstract void bind(InetAddress host, int port); protected abstract void close(); protected abstract void connect(String host, int port); protected abstract void connect(InetAddress address, int port); protected abstract void create(boolean stream); protected FileDescriptor getFileDescriptor(); protected InetAddress getInetAddress(); protected abstract InputStream getInputStream(); protected int getLocalPort(); protected abstract OutputStream getOutputStream(); protected int getPort(); protected abstract void listen(int backlog); }
The remote IP address to which this socket is connected.
The file descriptor that represents this socket.
The local port number of this socket.
The remote port number of this socket.
The string representation of this SocketImpl.
Object.toString()
This method returns a String that contains a representation of this object.
A SocketImpl to connect.
If any kind of I/O error occurs.
This method accepts a connection. The method connects the given socket s to a remote host in response to the remote host's connection request on this SocketImpl.
The number of bytes that can be read without blocking.
If any kind of I/O error occurs.
This method returns the number of bytes that can be read from the socket without waiting for more data to arrive.
protected abstract void bind(InetAddress host, int port) throws IOException
An IP address.
A port number.
If any kind of I/O error occurs.
This method binds the socket to the given address and port. If the address or the port is unavailable, an exception is thrown.
If any kind of I/O error occurs.
This method closes the socket, releasing any system resources it holds.
protected abstract void connect(String host, int port) throws IOException
A remote hostname.
A port number on the remote host.
If any kind of I/O error occurs.
This method connects this socket to the specified port on the given host.
protected abstract void connect(InetAddress address, int port) throws IOException
A remote IP address.
A port number on the remote host.
If any kind of I/O error occurs.
This method connects this socket to the specified port on the host at the given address.
A boolean value that indicates if this socket is a stream socket.
If any kind of I/O error occurs.
This method creates a socket that is not bound and not connected. If the stream argument is true, a stream socket is created. Otherwise, a datagram socket is created.
The file descriptor for this socket.
This method returns the file descriptor associated with this SocketImpl.
The remote IP address to which this SocketImpl is connected.
This method returns the IP address of the remote host to which this SocketImpl is connected.
An InputStream that wraps this socket.
If any kind of I/O error occurs.
This method returns an InputStream that reads data from the socket.
The local port number from which this SocketImpl originates.
This method returns the local port number that is the origin of the socket.
protected abstract OutputStream getOutputStream() throws IOException
An OutputStream that wraps this socket.
If any kind of I/O error occurs.
This method returns an OutputStream that sends data through the socket.
The remote port number to which this SocketImpl is connected.
This method returns the port number of the remote host to which this socket is connected.
The maximum length of pending connections queue.
If any kind of I/O error occurs.
This object can directly accept a connection if its accept() method has been called and is waiting for a connection. Otherwise, the local system rejects connections to this socket unless listen() has been called.
This method requests that the local system listen for connections and accept them on behalf of this object. The accepted connections are placed in a queue of the specified length. When there are connections in the queue, a call to this object's accept() method removes a connection from the queue and immediately returns. If the queue is full, additional connection requests are refused.
Method | Inherited From | Method | Inherited From |
---|---|---|---|
clone() |
Object |
equals(Object) |
Object |
finalize() |
Object |
getClass() |
Object |
hashCode() |
Object |
notify() |
Object |
notifyAll() |
Object |
wait() |
Object |
wait(long) |
Object |
wait(long, int) |
Object |
FileDescriptor, InetAddress, InputStream, IOException, OutputStream, ServerSocket, Socket, SocketImplFactory