java::net::SocketImpl Class Reference

Inheritance diagram for java::net::SocketImpl:

Inheritance graph
java::net::PlainSocketImpljava::net::SocketOptionsjava::lang::Interfacejava::lang::Object
[legend]
Collaboration diagram for java::net::SocketImpl:

Collaboration graph
java::net::SocketOptionsjava::lang::Interfacejava::lang::Object
[legend]

List of all members.


Detailed Description

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.

Author:
unascribed
Version:
1.38, 12/03/01
Since:
JDK1.0

Public Member Functions

virtual void create (jboolean stream)=0
 Creates either a stream or a datagram socket.
virtual void connect (const String &host, jint port, jint timeout=0)=0
 Connects this socket to the specified port on the named host.
virtual void connect (const Ref< InetAddress > &address, jint port, jint timeout=0)=0
 Connects this socket to the specified port number on the specified host.
virtual void bind (const Ref< InetAddress > &host, jint port)=0
 Binds this socket to the specified port number on the specified host.
virtual void listen (jint backlog)=0
 Sets the maximum queue length for incoming connection indications (a request to connect) to the count argument.
virtual void accept (const Ref< SocketImpl > &s)=0
 Accepts a connection.
virtual Ref
< InputStream
getInputStream ()=0
 Returns an input stream for this socket.
virtual Ref
< OutputStream
getOutputStream ()=0
 Returns an output stream for this socket.
virtual jint available ()=0
 Returns the number of bytes that can be read from this socket without blocking.
virtual void close ()=0
 Closes this socket.
virtual void shutdownInput ()
 Places the input stream for this socket at "end of stream".
virtual void shutdownOutput ()
 Disables the output stream for this socket.
virtual Ref
< FileDescriptor
getFileDescriptor () const
 Returns the value of this socket's fd field.
virtual Ref
< InetAddress
getInetAddress () const
 Returns the value of this socket's address field.
virtual jint getPort () const
 Returns the value of this socket's port field.
virtual jboolean supportsUrgentData () const
 Returns whether or not this SocketImpl supports sending urgent data.
virtual void sendUrgentData (jint data)=0
 Send one byte of urgent data on the socket.
virtual Ref
< InetAddress
getLocalAddress () const
 Returns the value of this socket's localAddress field.
virtual jint getLocalPort () const
 Returns the value of this socket's localPort field.
jboolean isConnected () const
 Returns the connection state of the socket.
jboolean isBound () const
 Returns the binding state of the socket.
jboolean isClosed () const
 Returns the closed state of the socket.
jboolean isInputShutdown () const
 Returns wether the read-half of the socket connection is closed.
jboolean isOutputShutdown () const
 Returns wether the write-half of the socket connection is closed.
virtual String toString () const
 Returns the address and port of this socket as a String.

Protected Member Functions

 SocketImpl ()

Protected Attributes

Ref< FileDescriptorfd
 The file descriptor object for this socket.
Ref< InetAddressaddress
 The IP address of the remote end of this socket.
jint port
 The port number on the remote host to which this socket is connected.
Ref< InetAddresslocalAddress
 The local IP address to which theis socket is connected.
jint localPort
 The local port number to which this socket is connected.
jboolean bound
 Various states of this socket.
jboolean connected
jboolean shutIn
jboolean shutOut

Constructor & Destructor Documentation

java::net::SocketImpl::SocketImpl (  )  [protected]


Member Function Documentation

virtual void java::net::SocketImpl::create ( jboolean  stream  )  [pure virtual]

Creates either a stream or a datagram socket.

Parameters:
stream if true, create a stream socket; otherwise, create a datagram socket.
Exceptions:
IOException if an I/O error occurs while creating the socket.

Implemented in java::net::PlainSocketImpl.

virtual void java::net::SocketImpl::connect ( const String host,
jint  port,
jint  timeout = 0 
) [pure virtual]

Connects this socket to the specified port on the named host.

Parameters:
host the name of the remote host.
port the port number.
timeout the timeout value, in milliseconds, or zero for no timeout.
Exceptions:
IOException if an I/O error occurs when connecting to the remote host.

Implemented in java::net::PlainSocketImpl.

virtual void java::net::SocketImpl::connect ( const Ref< InetAddress > &  address,
jint  port,
jint  timeout = 0 
) [pure virtual]

Connects this socket to the specified port number on the specified host.

Parameters:
address the IP address of the remote host.
port the port number.
timeout the timeout value, in milliseconds, or zero for no timeout.
Exceptions:
IOException if an I/O error occurs when attempting a connection.

Implemented in java::net::PlainSocketImpl.

virtual void java::net::SocketImpl::bind ( const Ref< InetAddress > &  host,
jint  port 
) [pure virtual]

Binds this socket to the specified port number on the specified host.

Parameters:
host the IP address of the remote host.
port the port number.
Exceptions:
IOException if an I/O error occurs when binding this socket.

Implemented in java::net::PlainSocketImpl.

virtual void java::net::SocketImpl::listen ( jint  backlog  )  [pure virtual]

Sets the maximum queue length for incoming connection indications (a request to connect) to the count argument.

If a connection indication arrives when the queue is full, the connection is refused.

Parameters:
backlog the maximum length of the queue.
Exceptions:
IOException if an I/O error occurs when creating the queue.

Implemented in java::net::PlainSocketImpl.

virtual void java::net::SocketImpl::accept ( const Ref< SocketImpl > &  s  )  [pure virtual]

Accepts a connection.

Parameters:
s the accepted connection.
Exceptions:
IOException if an I/O error occurs when accepting the connection.

Implemented in java::net::PlainSocketImpl.

virtual Ref<InputStream> java::net::SocketImpl::getInputStream (  )  [pure virtual]

Returns an input stream for this socket.

Returns:
a stream for reading from this socket.
Exceptions:
IOException if an I/O error occurs when creating the input stream.

Implemented in java::net::PlainSocketImpl.

virtual Ref<OutputStream> java::net::SocketImpl::getOutputStream (  )  [pure virtual]

Returns an output stream for this socket.

Returns:
an output stream for writing to this socket.
Exceptions:
IOException if an I/O error occurs when creating the output stream.

Implemented in java::net::PlainSocketImpl.

virtual jint java::net::SocketImpl::available (  )  [pure virtual]

Returns the number of bytes that can be read from this socket without blocking.

Returns:
the number of bytes that can be read from this socket without blocking.
Exceptions:
IOException if an I/O error occurs when determining the number of bytes available.

Implemented in java::net::PlainSocketImpl.

virtual void java::net::SocketImpl::close (  )  [pure virtual]

Closes this socket.

Exceptions:
IOException if an I/O error occurs when closing this socket.

Implemented in java::net::PlainSocketImpl.

virtual void java::net::SocketImpl::shutdownInput (  )  [virtual]

Places the input stream for this socket at "end of stream".

Any data sent to this socket is acknowledged and then silently discarded.

If you read from a socket input stream after invoking shutdownInput() on the socket, the stream will return EOF.

Exceptions:
IOException if an I/O error occurs when shutting down this socket.
See also:
java.net.Socket::shutdownOutput()

java.net.Socket::close()

java.net.Socket::setSoLinger(boolean, int)

Reimplemented in java::net::PlainSocketImpl.

virtual void java::net::SocketImpl::shutdownOutput (  )  [virtual]

Disables the output stream for this socket.

For a TCP socket, any previously written data will be sent followed by TCP's normal connection termination sequence.

If you write to a socket output stream after invoking shutdownOutput() on the socket, the stream will throw an IOException.

Exceptions:
IOException if an I/O error occurs when shutting down this socket.
See also:
java.net.Socket::shutdownInput()

java.net.Socket::close()

java.net.Socket::setSoLinger(boolean, int)

Reimplemented in java::net::PlainSocketImpl.

virtual Ref<FileDescriptor> java::net::SocketImpl::getFileDescriptor (  )  const [virtual]

Returns the value of this socket's fd field.

Returns:
the value of this socket's fd field.
See also:
java.net.SocketImpl::fd

virtual Ref<InetAddress> java::net::SocketImpl::getInetAddress (  )  const [virtual]

Returns the value of this socket's address field.

Returns:
the value of this socket's address field.
See also:
java.net.SocketImpl::address

virtual jint java::net::SocketImpl::getPort (  )  const [virtual]

Returns the value of this socket's port field.

Returns:
the value of this socket's port field.
See also:
java.net.SocketImpl::port

virtual jboolean java::net::SocketImpl::supportsUrgentData (  )  const [virtual]

Returns whether or not this SocketImpl supports sending urgent data.

By default, false is returned unless the method is overridden in a sub-class

Returns:
true if urgent data supported
See also:
java.net.SocketImpl::address
Since:
1.4

Reimplemented in java::net::PlainSocketImpl.

virtual void java::net::SocketImpl::sendUrgentData ( jint  data  )  [pure virtual]

Send one byte of urgent data on the socket.

The byte to be sent is the low eight bits of the parameter

Parameters:
data The byte of data to send
Exceptions:
IOException if there is an error sending the data.
Since:
1.4

Implemented in java::net::PlainSocketImpl.

virtual Ref<InetAddress> java::net::SocketImpl::getLocalAddress (  )  const [virtual]

Returns the value of this socket's localAddress field.

Returns:
the value of this socket's localAddress field.
See also:
java.net.SocketImpl::localAddress

virtual jint java::net::SocketImpl::getLocalPort (  )  const [virtual]

Returns the value of this socket's localPort field.

Returns:
the value of this socket's localPort field.
See also:
java.net.SocketImpl::localPort

jboolean java::net::SocketImpl::isConnected (  )  const

Returns the connection state of the socket.

Returns:
true if the socket successfuly connected to a server
Since:
1.4

jboolean java::net::SocketImpl::isBound (  )  const

Returns the binding state of the socket.

Returns:
true if the socket successfuly bound to an address
Since:
1.4
See also:
bind

jboolean java::net::SocketImpl::isClosed (  )  const

Returns the closed state of the socket.

Returns:
true if the socket has been closed
Since:
1.4
See also:
close

jboolean java::net::SocketImpl::isInputShutdown (  )  const

Returns wether the read-half of the socket connection is closed.

Returns:
true if the input of the socket has been shutdown
Since:
1.4
See also:
shutdownInput

jboolean java::net::SocketImpl::isOutputShutdown (  )  const

Returns wether the write-half of the socket connection is closed.

Returns:
true if the output of the socket has been shutdown
Since:
1.4
See also:
shutdownOutput

virtual String java::net::SocketImpl::toString (  )  const [virtual]

Returns the address and port of this socket as a String.

Returns:
a string representation of this socket.

Reimplemented from java::lang::Object.


Member Data Documentation

Ref<FileDescriptor> java::net::SocketImpl::fd [protected]

The file descriptor object for this socket.

Ref<InetAddress> java::net::SocketImpl::address [protected]

The IP address of the remote end of this socket.

jint java::net::SocketImpl::port [protected]

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

Ref<InetAddress> java::net::SocketImpl::localAddress [protected]

The local IP address to which theis socket is connected.

jint java::net::SocketImpl::localPort [protected]

The local port number to which this socket is connected.

jboolean java::net::SocketImpl::bound [protected]

Various states of this socket.

jboolean java::net::SocketImpl::connected [protected]

jboolean java::net::SocketImpl::shutIn [protected]

jboolean java::net::SocketImpl::shutOut [protected]


The documentation for this class was generated from the following file:
Generated on Fri May 16 11:56:44 2008 for CrossPlatformJavaLikeC++API by  doxygen 1.5.3