Packages  This Package  Prev  Next  Index  

§4.7 Class SocketImpl

public  abstract  class  java.net.SocketImpl
    extends  java.lang.Object  (I-§1.12)
{
        // Fields
    protected InetAddress address;	§4.7.1
    protected FileDescriptor fd;	§4.7.2
    protected int localport;	§4.7.3
    protected int port;	§4.7.4

        // Constructors
    public SocketImpl();	§4.7.5

        // Methods
    protected abstract void accept(SocketImpl  s);	§4.7.6
    protected abstract int available();	§4.7.7
    protected abstract void bind(InetAddress  host, int  port);	§4.7.8
    protected abstract void close();	§4.7.9
    protected abstract void	§4.7.10
        connect(InetAddress  address, int  port);
    protected abstract void connect(String  host, int  port);	§4.7.11
    protected abstract void create(boolean  stream);	§4.7.12
    protected FileDescriptor getFileDescriptor();	§4.7.13
    protected InetAddress getInetAddress();	§4.7.14
    protected abstract InputStream getInputStream();	§4.7.15
    protected int getLocalPort();	§4.7.16
    protected abstract OutputStream getOutputStream();	§4.7.17
    protected int getPort();	§4.7.18
    protected abstract void listen(int  count);	§4.7.19
    public String toString();	§4.7.20
}
The abstract class SocketImpl is a common superclass of all classes that actually implement sockets. It is used to create both client and server sockets.

A "plain" socket implements these methods exactly as described, without attempting to go through a firewall or proxy.


Fields

address

protected InetAddress address
The IP address of the remote end of this socket.

fd

protected FileDescriptor fd
The file descriptor object for this socket.

localport

protected int localport
The local port number to which this socket is connected

port

protected int port
The port number on the remote host to which this socket is connected.

Constructors

SocketImpl

public SocketImpl()
The default constructor for a socket implementation.

Methods

accept

protected abstract void accept(SocketImpl s) throws IOException
Accepts a connection.
Parameters:
s - the accepted connection
Throws
IOException (I-§2.29)
If an I/O error occurs when accepting the connection.

available

protected abstract int available() throws IOException
Returns:
the number of bytes that can be read from this socket without blocking.
Throws
IOException (I-§2.29)
If an I/O error occurs when determining the number of bytes available.

bind

protected abstract void bind(InetAddress host, int port) throws IOException
Binds this socket to the specified port number on the specified host.
Parameters:
host - the IP address of the remote hsot
port - the port number
Throws
IOException (I-§2.29)
If an I/O error occurs when binding this socket.

close

protected abstract void close() throws IOException
Closes this socket.
Throws
IOException (I-§2.29)
If an I/O error occurs when closing this socket.

connect

protected abstract void
connect(InetAddress address, int port)
throws IOException
Connects this socket to the specified port number on the specified host.
Parameters:
address - the IP address of the remote host
<