DthingApi
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
java.net.SocketImpl Class Referenceabstract
Inheritance diagram for java.net.SocketImpl:
java.net.SocketOptions java.net.PlainSocketImpl

Public Member Functions

String toString ()
 
- Public Member Functions inherited from java.net.SocketOptions
Object getOption (int optID) throws SocketException
 
void setOption (int optID, int val) throws SocketException
 

Protected Member Functions

abstract int available () throws IOException
 
abstract void bind (InetAddress address, int port) throws IOException
 
abstract void close () throws IOException
 
abstract void connect (String host, int port) throws IOException
 
abstract void connect (InetAddress address, int port) throws IOException
 
abstract void create () throws IOException
 
InetAddress getInetAddress ()
 
abstract InputStream getInputStream () throws IOException
 
int getLocalPort ()
 
abstract OutputStream getOutputStream () throws IOException
 
int getPort ()
 
void shutdownInput () throws IOException
 
void shutdownOutput () throws IOException
 
abstract void connect (SocketAddress remoteAddr, int timeout) throws IOException
 
void setPerformancePreferences (int connectionTime, int latency, int bandwidth)
 

Protected Attributes

InetAddress address
 
int port
 
int localport
 

Additional Inherited Members

- Static Public Attributes inherited from java.net.SocketOptions
static final int SO_LINGER = 128
 
static final int SO_TIMEOUT = 4102
 
static final int TCP_NODELAY = 1
 
static final int IP_MULTICAST_IF = 16
 
static final int SO_BINDADDR = 15
 
static final int SO_REUSEADDR = 4
 
static final int SO_SNDBUF = 4097
 
static final int SO_RCVBUF = 4098
 
static final int SO_KEEPALIVE = 8
 
static final int IP_TOS = 3
 
static final int IP_MULTICAST_LOOP = 18
 
static final int SO_BROADCAST = 32
 
static final int SO_OOBINLINE = 4099
 
static final int IP_MULTICAST_IF2 = 31
 

Detailed Description

This class is the base of all streaming socket implementation classes. Streaming sockets are wrapped by two classes,

ServerSocket

and

Socket

at the server and client end of a connection. At the server, there are two types of sockets engaged in communication, the

ServerSocket

on a well known port (referred to as listener) used to establish a connection and the resulting

Socket

(referred to as host).

Member Function Documentation

◆ available()

abstract int java.net.SocketImpl.available ( ) throws IOException
abstractprotected

Returns the available number of bytes which are readable from this socket without blocking.

Returns
the number of bytes that may be read without blocking.
Exceptions
IOExceptionif an error occurs while reading the number of bytes.

◆ bind()

abstract void java.net.SocketImpl.bind ( InetAddress  address,
int  port 
) throws IOException
abstractprotected

Binds this socket to the specified local host address and port number.

Parameters
addressthe local machine address to bind this socket to.
portthe port on the local machine to bind this socket to.
Exceptions
IOExceptionif an error occurs while binding this socket.

◆ close()

abstract void java.net.SocketImpl.close ( ) throws IOException
abstractprotected

Closes this socket. This makes later access invalid.

Exceptions
IOExceptionif an error occurs while closing this socket.

◆ connect() [1/3]

abstract void java.net.SocketImpl.connect ( String  host,
int  port 
) throws IOException
abstractprotected

Connects this socket to the specified remote host and port number.

Parameters
hostthe remote host this socket has to be connected to.
portthe remote port on which this socket has to be connected.
Exceptions
IOExceptionif an error occurs while connecting to the remote host.

◆ connect() [2/3]

abstract void java.net.SocketImpl.connect ( InetAddress  address,
int  port 
) throws IOException
abstractprotected

Connects this socket to the specified remote host address and port number.

Parameters
addressthe remote host address this socket has to be connected to.
portthe remote port on which this socket has to be connected.
Exceptions
IOExceptionif an error occurs while connecting to the remote host.

◆ connect() [3/3]

abstract void java.net.SocketImpl.connect ( SocketAddress  remoteAddr,
int  timeout 
) throws IOException
abstractprotected

Connects this socket to the remote host address and port number specified by the

SocketAddress

object with the given timeout. This method will block indefinitely if the timeout is set to zero.

Parameters
remoteAddrthe remote host address and port number to connect to.
timeoutthe timeout value in milliseconds.
Exceptions
IOExceptionif an error occurs while connecting.

◆ create()

abstract void java.net.SocketImpl.create ( ) throws IOException
abstractprotected

Creates a new unconnected socket. The argument

isStreaming

defines whether the new socket is a streaming or a datagram socket.

Parameters
isStreamingdefines whether the type of the new socket is streaming or datagram.
Exceptions
IOExceptionif an error occurs while creating the socket.

◆ getInetAddress()

InetAddress java.net.SocketImpl.getInetAddress ( )
inlineprotected

Gets the remote address this socket is connected to.

Returns
the remote address of this socket.

◆ getInputStream()

abstract InputStream java.net.SocketImpl.getInputStream ( ) throws IOException
abstractprotected

Gets the input stream of this socket.

Returns
the input stream of this socket.
Exceptions
IOExceptionif an error occurs while accessing the input stream.

◆ getLocalPort()

int java.net.SocketImpl.getLocalPort ( )
inlineprotected

Gets the local port number of this socket. 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.

Returns
the local port number this socket is bound to.

◆ getOutputStream()

abstract OutputStream java.net.SocketImpl.getOutputStream ( ) throws IOException
abstractprotected

Gets the output stream of this socket.

Returns
the output stream of this socket.
Exceptions
IOExceptionif an error occurs while accessing the output stream.

◆ getPort()

int java.net.SocketImpl.getPort ( )
inlineprotected

Gets the remote port number of this socket. This value is not meaningful when this instance is wrapped by a

ServerSocket

.

Returns
the remote port this socket is connected to.

◆ setPerformancePreferences()

void java.net.SocketImpl.setPerformancePreferences ( int  connectionTime,
int  latency,
int  bandwidth 
)
inlineprotected

Sets performance preference for connection time, latency and bandwidth. Does nothing by default.

Parameters
connectionTimethe importance of connect time.
latencythe importance of latency.
bandwidththe importance of bandwidth.

◆ shutdownInput()

void java.net.SocketImpl.shutdownInput ( ) throws IOException
inlineprotected

Closes the input channel of this socket.

This default implementation always throws an IOException to indicate that the subclass should have overridden this method.

Exceptions
IOExceptionalways because this method should be overridden.

◆ shutdownOutput()

void java.net.SocketImpl.shutdownOutput ( ) throws IOException
inlineprotected

Closes the output channel of this socket.

This default implementation always throws an IOException to indicate that the subclass should have overridden this method.

Exceptions
IOExceptionalways because this method should be overridden.

◆ toString()

String java.net.SocketImpl.toString ( )
inline

Returns a string containing a concise, human-readable description of the socket.

Returns
the textual representation of this socket.

Member Data Documentation

◆ address

InetAddress java.net.SocketImpl.address
protected

The remote address this socket is connected to.

◆ localport

int java.net.SocketImpl.localport
protected

The local port this socket is connected to.

◆ port

int java.net.SocketImpl.port
protected

The remote port this socket is connected to.


The documentation for this class was generated from the following file: