java.net
Class DatagramSocketImpl
- SocketOptions
This abstract class models a datagram socket implementation. An
actual implementation class would implement these methods, probably
via redirecting them to native code.
Written using on-line Java Platform 1.2 API Specification, as well
as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
Status: Believed complete and correct.
- 1.1
protected FileDescriptor | fd - The FileDescriptor object for this object.
|
protected int | localPort - The local port to which this socket is bound
|
IP_MULTICAST_IF , IP_MULTICAST_IF2 , IP_MULTICAST_LOOP , IP_TOS , SO_BINDADDR , SO_BROADCAST , SO_KEEPALIVE , SO_LINGER , SO_OOBINLINE , SO_RCVBUF , SO_REUSEADDR , SO_SNDBUF , SO_TIMEOUT , TCP_NODELAY |
protected void | bind(int lport, InetAddress laddr) - This method binds the socket to the specified local port and address.
|
protected void | close() - This methods closes the socket
|
protected void | connect(InetAddress address, int port) - Connects the socket to a host specified by address and port.
|
protected void | create() - Creates a new datagram socket.
|
protected void | disconnect() - Disconnects the socket.
|
protected FileDescriptor | getFileDescriptor() - Returns the FileDescriptor for this socket
|
protected int | getLocalPort() - Returns the local port this socket is bound to
|
protected byte | getTTL() - // FIXME: when ?
|
protected int | getTimeToLive() - This method returns the current Time to Live (TTL) setting on this
socket.
|
protected void | join(InetAddress inetaddr) - Causes this socket to join the specified multicast group
|
protected void | joinGroup(SocketAddress mcastaddr, NetworkInterface netIf) - Causes this socket to join the specified multicast group on a specified
device
|
protected void | leave(InetAddress inetaddr) - Causes the socket to leave the specified multicast group.
|
protected void | leaveGroup(SocketAddress mcastaddr, NetworkInterface netIf) - Leaves a multicast group
|
protected int | peek(InetAddress i) - Takes a peek at the next packet received in order to retrieve the
address of the sender
|
protected int | peekData(DatagramPacket p) - Takes a peek at the next packet received.
|
protected void | receive(DatagramPacket p) - Receives a packet of data from the network Will block until a packet
arrives.
|
protected void | send(DatagramPacket p) - Transmits the specified packet of data to the network.
|
protected void | setTTL(byte ttl)
|
protected void | setTimeToLive(int ttl) - Sets the Time to Live (TTL) setting on this socket to the specified
value.
|
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait |
localPort
protected int localPort
The local port to which this socket is bound
DatagramSocketImpl
public DatagramSocketImpl()
Default, no-argument constructor for subclasses to call.
bind
protected void bind(int lport,
InetAddress laddr)
throws SocketException
This method binds the socket to the specified local port and address.
lport
- The port number to bind toladdr
- The address to bind to
SocketException
- If an error occurs
close
protected void close()
This methods closes the socket
connect
protected void connect(InetAddress address,
int port)
throws SocketException
Connects the socket to a host specified by address and port.
address
- The InetAddress
of the host to connect toport
- The port number of the host to connect to
SocketException
- If an error occurs
- 1.4
disconnect
protected void disconnect()
Disconnects the socket.
- 1.4
getLocalPort
protected int getLocalPort()
Returns the local port this socket is bound to
- the local port
getTTL
protected byte getTTL()
throws IOException
// FIXME: when ?
This method returns the current Time to Live (TTL) setting on this
socket. Use getTimeToLive()
instead.
- the current time-to-live
IOException
- If an error occurs
getTimeToLive
protected int getTimeToLive()
throws IOException
This method returns the current Time to Live (TTL) setting on this
socket.
- the current time-to-live
IOException
- If an error occurs
join
protected void join(InetAddress inetaddr)
throws IOException
Causes this socket to join the specified multicast group
inetaddr
- The multicast address to join with
IOException
- If an error occurs
joinGroup
protected void joinGroup(SocketAddress mcastaddr,
NetworkInterface netIf)
throws IOException
Causes this socket to join the specified multicast group on a specified
device
mcastaddr
- The address to leavenetIf
- The specified network interface to join the group at
IOException
- If an error occurs
- 1.4
leave
protected void leave(InetAddress inetaddr)
throws IOException
Causes the socket to leave the specified multicast group.
inetaddr
- The multicast address to leave
IOException
- If an error occurs
peek
protected int peek(InetAddress i)
throws IOException
Takes a peek at the next packet received in order to retrieve the
address of the sender
i
- The InetAddress
to fill in with the information
about the sender if the next packet
- The port number of the sender of the packet
IOException
- If an error occurs
peekData
protected int peekData(DatagramPacket p)
throws IOException
Takes a peek at the next packet received. This packet is not consumed.
With the next peekData/receive operation this packet will be read again.
p
- The DatagramPacket
to fill in with the data sent.
- The port number of the sender of the packet.
IOException
- If an error occurs
- 1.4
receive
protected void receive(DatagramPacket p)
throws IOException
Receives a packet of data from the network Will block until a packet
arrives. The packet info in populated into the passed in
DatagramPacket
object.
p
- A place to store the incoming packet.
IOException
- If an error occurs
send
protected void send(DatagramPacket p)
throws IOException
Transmits the specified packet of data to the network. The destination
host and port should be encoded in the packet.
p
- The packet to send
IOException
- If an error occurs
setTTL
protected void setTTL(byte ttl)
throws IOException
Sets the Time to Live (TTL) setting on this socket to the specified
value. Use setTimeToLive(int)
instead.
ttl
- The new Time to Live value
IOException
- If an error occurs
setTimeToLive
protected void setTimeToLive(int ttl)
throws IOException
Sets the Time to Live (TTL) setting on this socket to the specified
value.
ttl
- The new Time to Live value
IOException
- If an error occurs
DatagramSocketImpl.java -- Abstract class for UDP socket implementations
Copyright (C) 1998, 1999 2000, 2001,
2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.