java::net::DatagramSocketImpl Class Reference

Inheritance diagram for java::net::DatagramSocketImpl:

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

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

List of all members.


Detailed Description

Abstract datagram and multicast socket implementation base class.

Author:
Pavani Diwanji

Yuh-Jye Chang

Since:
JDK1.1

Public Member Functions

virtual void create ()=0
 Creates a datagram socket.
virtual void bind (const Ref< InetAddress > &laddr, jint lport)=0
 Binds a datagram socket to a local port and address.
virtual void connect (const Ref< InetAddress > &address, jint port)
 Connects a datagram socket to a remote destination.
virtual void disconnect ()
 Disconnects a datagram socket from its remote destination.
virtual void send (const Ref< DatagramPacket > &p)=0
 Sends a datagram packet.
virtual jint peek (const Ref< InetAddress > &i)=0
 Peek at the packet to see who it is from.
virtual jint peekData (const Ref< DatagramPacket > &p)=0
 Peek at the packet to see who it is from.
virtual void receive (const Ref< DatagramPacket > &p)=0
 Receive the datagram packet.
virtual void setTimeToLive (jint ttl)=0
 Set the TTL (time-to-live) option.
virtual jint getTimeToLive () const =0
 Retrieve the TTL (time-to-live) option.
virtual void join (const Ref< InetAddress > &inetaddr)=0
 Join the multicast group.
virtual void leave (const Ref< InetAddress > &inetaddr)=0
 Leave the multicast group.
virtual void joinGroup (const Ref< SocketAddress > &mcastaddr, const Ref< NetworkInterface > &netIf)=0
 Join the multicast group.
virtual void leaveGroup (const Ref< SocketAddress > &mcastaddr, const Ref< NetworkInterface > &netIf)=0
 Leave the multicast group.
virtual void close ()=0
 Closes 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 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.
virtual String toString () const
 Returns the address and port of this socket as a String.

Protected Member Functions

 DatagramSocketImpl ()

Protected Attributes

Ref< FileDescriptorfd
 The file descriptor object for this socket.
Ref< InetAddresslocalAddress
jint localPort
jboolean bound
 Various states of this socket.
jboolean connected
Ref< InetAddressconnectedAddress
jint connectedPort

Constructor & Destructor Documentation

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


Member Function Documentation

virtual void java::net::DatagramSocketImpl::create (  )  [pure virtual]

Creates a datagram socket.

Exceptions:
SocketException if there is an error in the underlying protocol, such as a TCP error.

virtual void java::net::DatagramSocketImpl::bind ( const Ref< InetAddress > &  laddr,
jint  lport 
) [pure virtual]

Binds a datagram socket to a local port and address.

Parameters:
lport the local port
laddr the local address
Exceptions:
SocketException if there is an error in the underlying protocol, such as a TCP error.

virtual void java::net::DatagramSocketImpl::connect ( const Ref< InetAddress > &  address,
jint  port 
) [virtual]

Connects a datagram socket to a remote destination.

This associates the remote address with the local socket so that datagrams may only be sent to this destination and received from this destination. This may be overridden to call a native system connect.

If the remote destination to which the socket is connected does not exist, or is otherwise unreachable, and if an ICMP destination unreachable packet has been received for that address, then a subsequent call to send or receive may throw a PortUnreachableException. Note, there is no guarantee that the exception will be thrown.

Parameters:
address the remote InetAddress to connect to
port the remote port number
Exceptions:
SocketException may be thrown if the socket cannot be connected to the remote destination
Since:
1.4

virtual void java::net::DatagramSocketImpl::disconnect (  )  [virtual]

Disconnects a datagram socket from its remote destination.

Since:
1.4

virtual void java::net::DatagramSocketImpl::send ( const Ref< DatagramPacket > &  p  )  [pure virtual]

Sends a datagram packet.

The packet contains the data and the destination address to send the packet to.

Parameters:
p the packet to be sent.
Exceptions:
IOException if an I/O exception occurs while sending the datagram packet.
PortUnreachableException may be thrown if the socket is connected to a currently unreachable destination. Note, there is no guarantee that the exception will be thrown.

virtual jint java::net::DatagramSocketImpl::peek ( const Ref< InetAddress > &  i  )  [pure virtual]

Peek at the packet to see who it is from.

Parameters:
i an InetAddress object
Returns:
the address which the packet came from.
Exceptions:
IOException if an I/O exception occurs
PortUnreachableException may be thrown if the socket is connected to a currently unreachable destination. Note, there is no guarantee that the exception will be thrown.

virtual jint java::net::DatagramSocketImpl::peekData ( const Ref< DatagramPacket > &  p  )  [pure virtual]

Peek at the packet to see who it is from.

The data is returned, but not consumed, so that a subsequent peekData/receive operation will see the same data.

Parameters:
p the Packet Received.
Returns:
the address which the packet came from.
Exceptions:
IOException if an I/O exception occurs
PortUnreachableException may be thrown if the socket is connected to a currently unreachable destination. Note, there is no guarantee that the exception will be thrown.
Since:
1.4

virtual void java::net::DatagramSocketImpl::receive ( const Ref< DatagramPacket > &  p  )  [pure virtual]

Receive the datagram packet.

Parameters:
p the Packet Received.
Exceptions:
IOException if an I/O exception occurs while receiving the datagram packet.
PortUnreachableException may be thrown if the socket is connected to a currently unreachable destination. Note, there is no guarantee that the exception will be thrown.

virtual void java::net::DatagramSocketImpl::setTimeToLive ( jint  ttl  )  [pure virtual]

Set the TTL (time-to-live) option.

Parameters:
ttl an int specifying the time-to-live value
Exceptions:
IOException if an I/O exception occurs while setting the time-to-live option.
See also:
getTimeToLive()

virtual jint java::net::DatagramSocketImpl::getTimeToLive (  )  const [pure virtual]

Retrieve the TTL (time-to-live) option.

Exceptions:
IOException if an I/O exception occurs while retrieving the time-to-live option
Returns:
an int representing the time-to-live value
See also:
setTimeToLive(int)

virtual void java::net::DatagramSocketImpl::join ( const Ref< InetAddress > &  inetaddr  )  [pure virtual]

Join the multicast group.

Parameters:
inetaddr multicast address to join.
Exceptions:
IOException if an I/O exception occurs while joining the multicast group.

virtual void java::net::DatagramSocketImpl::leave ( const Ref< InetAddress > &  inetaddr  )  [pure virtual]

Leave the multicast group.

Parameters:
inetaddr multicast address to leave.
Exceptions:
IOException if an I/O exception occurs while leaving the multicast group.

virtual void java::net::DatagramSocketImpl::joinGroup ( const Ref< SocketAddress > &  mcastaddr,
const Ref< NetworkInterface > &  netIf 
) [pure virtual]

Join the multicast group.

Parameters:
mcastaddr address to join.
netIf specifies the local interface to receive multicast datagram packets
Exceptions:
IOException if an I/O exception occurs while joining the multicast group
Since:
1.4

virtual void java::net::DatagramSocketImpl::leaveGroup ( const Ref< SocketAddress > &  mcastaddr,
const Ref< NetworkInterface > &  netIf 
) [pure virtual]

Leave the multicast group.

Parameters:
mcastaddr address to leave.
netIf specified the local interface to leave the group at
Exceptions:
IOException if an I/O exception occurs while leaving the multicast group
Since:
1.4

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

Closes this socket.

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

virtual Ref<FileDescriptor> java::net::DatagramSocketImpl::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::DatagramSocketImpl::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::DatagramSocketImpl::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 Ref<InetAddress> java::net::DatagramSocketImpl::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::DatagramSocketImpl::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::DatagramSocketImpl::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::DatagramSocketImpl::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::DatagramSocketImpl::isClosed (  )  const

Returns the closed state of the socket.

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

virtual String java::net::DatagramSocketImpl::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::DatagramSocketImpl::fd [protected]

The file descriptor object for this socket.

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

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

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

Various states of this socket.

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

Ref<InetAddress> java::net::DatagramSocketImpl::connectedAddress [protected]

jint java::net::DatagramSocketImpl::connectedPort [protected]


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