java.net
Class SocketImpl

java.lang.Object
  |
  +--java.net.SocketImpl

public abstract class SocketImpl
extends Object

This is the Socket implementation class. It is an abstract class that must be subclassed to provide an actual implementation.


Field Summary
protected  InetAddress address
          The internet address where the socket will make a connection.
protected  FileDescriptor fd
          The file descriptor object
protected  int localport
           
protected  int port
          The port where the socket will make a connection.
 
Constructor Summary
SocketImpl()
           
 
Method Summary
protected abstract  void accept(SocketImpl s)
          Accepts a connection.
protected abstract  int available()
          Returns the number of bytes that can be read without blocking.
protected abstract  void bind(InetAddress host, int port)
          Binds the socket to the specified port on the specified host.
protected abstract  void close()
          Closes the socket.
protected abstract  void connect(InetAddress address, int port)
          Connects the socket to the specified address on the specified port.
protected abstract  void connect(String host, int port)
          Connects the socket to the specified port on the specified host.
protected abstract  void create(boolean stream)
          Creates a socket with a boolean that specifies whether this is a stream socket or a datagram socket.
protected  FileDescriptor getFileDescriptor()
           
protected  InetAddress getInetAddress()
           
protected abstract  InputStream getInputStream()
          Gets an InputStream for this socket.
protected  int getLocalPort()
           
protected abstract  OutputStream getOutputStream()
          Gets an OutputStream for this socket.
protected  int getPort()
           
protected abstract  void listen(int backlog)
          Specify to the system how many connection requests the system will queue up while waiting for the SocketImpl to execute accept().
 String toString()
          Returns the address and port of this Socket as a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fd

protected FileDescriptor fd
The file descriptor object


address

protected InetAddress address
The internet address where the socket will make a connection.


port

protected int port
The port where the socket will make a connection.


localport

protected int localport
Constructor Detail

SocketImpl

public SocketImpl()
Method Detail

create

protected abstract void create(boolean stream)
                        throws IOException
Creates a socket with a boolean that specifies whether this is a stream socket or a datagram socket.

Parameters:
stream - a boolean indicating whether this is a stream or datagram socket
IOException

connect

protected abstract void connect(String host,
                                int port)
                         throws IOException
Connects the socket to the specified port on the specified host.

Parameters:
host - the specified host of the connection
port - the port where the connection is made
IOException

connect

protected abstract void connect(InetAddress address,
                                int port)
                         throws IOException
Connects the socket to the specified address on the specified port.

Parameters:
address - the specified address of the connection
port - the specified port where connection is made
IOException

bind

protected abstract void bind(InetAddress host,
                             int port)
                      throws IOException
Binds the socket to the specified port on the specified host.

Parameters:
host - the host
port - the port
IOException

listen

protected abstract void listen(int backlog)
                        throws IOException
Specify to the system how many connection requests the system will queue up while waiting for the SocketImpl to execute accept().

Parameters:
backlog - the number of queued connect requests pending accept
IOException

accept

protected abstract void accept(SocketImpl s)
                        throws IOException
Accepts a connection.

Parameters:
s - the accepted connection
IOException

getInputStream

protected abstract InputStream getInputStream()
                                       throws IOException
Gets an InputStream for this socket.

IOException

getOutputStream

protected abstract OutputStream getOutputStream()
                                         throws IOException
Gets an OutputStream for this socket.

IOException

available

protected abstract int available()
                          throws IOException
Returns the number of bytes that can be read without blocking.

IOException

close

protected abstract void close()
                       throws IOException
Closes the socket.

IOException

getFileDescriptor

protected FileDescriptor getFileDescriptor()

getInetAddress

protected InetAddress getInetAddress()

getPort

protected int getPort()

getLocalPort

protected int getLocalPort()

toString

public String toString()
Returns the address and port of this Socket as a String.

Overrides:
toString in class Object