|
|||||||||
| Home >> All >> com >> act365 >> [ net overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.act365.net
Class GeneralDatagramSocketImpl

java.lang.Objectjava.net.DatagramSocketImpl
com.act365.net.GeneralDatagramSocketImpl
- All Implemented Interfaces:
- java.net.SocketOptions
- Direct Known Subclasses:
- ICMPDatagramSocketImpl, RawICMPDatagramSocketImpl, RawTCPDatagramSocketImpl, RawTCPJDatagramSocketImpl, RawUDPDatagramSocketImpl, TCPDatagramSocketImpl, TCPJDatagramSocketImpl, UDPDatagramSocketImpl
- public abstract class GeneralDatagramSocketImpl
- extends java.net.DatagramSocketImpl
GeneralDatagramSocketImpl extends java.net.DatagramSocketImpl
and provides native implementations of all of its abstract methods. The
class remains abstract because it leaves its create() method
undefined - it is up to subclasses to specify the parameters that will
be used to create the underlying socket.
| Field Summary |
| Fields inherited from class java.net.DatagramSocketImpl |
fd, localPort |
| Fields inherited from interface java.net.SocketOptions |
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 |
| Constructor Summary | |
GeneralDatagramSocketImpl()
|
|
| Method Summary | |
(package private) static int |
_bind(int sd,
byte[] ipAddress,
int port)
|
(package private) static int |
_close(int sd)
|
(package private) static java.lang.Object |
_getOption(int socketDescriptor,
int optionName)
|
(package private) static int |
_getSocketDescriptor(java.io.FileDescriptor fd)
|
(package private) static void |
_receive(int sd,
java.net.DatagramPacket dgram,
int flags)
|
(package private) static void |
_send(int sd,
byte[] ipAddress,
int port,
byte[] data,
int length)
|
(package private) static int |
_setOption(int socketDescriptor,
int optionName,
java.lang.Object newValue)
|
(package private) static void |
_setSocketDescriptor(java.io.FileDescriptor fd,
int sd)
|
(package private) static int |
_socket(int addressFamily,
int socketType,
int protocol,
boolean headerincluded)
|
void |
bind(int localPort,
java.net.InetAddress inetAddress)
Binds this socket to a local port. |
void |
close()
Closes this socket. |
void |
create(int socketType,
int protocol,
boolean headerincluded)
Creates a new unconnected socket. |
java.lang.Object |
getOption(int optID)
Gets the value of a socket option. |
static int |
getSocketDescriptor(java.io.FileDescriptor fd)
Gets the socket descriptor from a java.io.FileDescriptor object. |
int |
getTimeToLive()
Retrieves time-to-live for multicast sockets. |
byte |
getTTL()
Retrieves time-to-live for multicast sockets. |
void |
join(java.net.InetAddress groupAddr)
Joins a multicast group. |
void |
joinGroup(java.net.SocketAddress mcastaddr,
java.net.NetworkInterface netIf)
Joins a multicast group. |
void |
leave(java.net.InetAddress groupAddr)
Leaves a multicast group. |
void |
leaveGroup(java.net.SocketAddress mcastaddr,
java.net.NetworkInterface netIf)
Leaves a multicast group. |
int |
peek(java.net.InetAddress sender)
Polls until a datagram packet is received. |
int |
peekData(java.net.DatagramPacket p)
Extracts the next DatagramPacket and returns the port number. |
void |
receive(java.net.DatagramPacket dgram)
Reads a datagram packet. |
void |
send(java.net.DatagramPacket dgram)
Sends a datagram packet. |
void |
setOption(int optID,
java.lang.Object value)
Sets the value of a socket option. |
static void |
setSocketDescriptor(java.io.FileDescriptor fd,
int sd)
Sets the socket descriptor for a java.io.FileDescriptor object. |
void |
setTimeToLive(int ttl)
Sets time-to-live for multicast sockets. |
void |
setTTL(byte ttl)
Sets time-to-live for multicast sockets. |
| Methods inherited from class java.net.DatagramSocketImpl |
connect, create, disconnect, getFileDescriptor, getLocalPort |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
GeneralDatagramSocketImpl
public GeneralDatagramSocketImpl()
| Method Detail |
create
public void create(int socketType,
int protocol,
boolean headerincluded)
throws java.net.SocketException
- Creates a new unconnected socket. The socket is allowed to be of any type
and use any protocol supported by the underlying operating system. The method
create()- note no arguments - should be defined in a subclass and call the version in the superclass with the parameters set appropriately. When a raw socket is set up, the user has the option to write his own IP header sockets (setheaderincludedtotrue) or to allow the operating system to write the headers. NB The option does not exist on Windows, where theIP_HDRINCLsymbol is unsupported.
_socket
static int _socket(int addressFamily,
int socketType,
int protocol,
boolean headerincluded)
bind
public void bind(int localPort,
java.net.InetAddress inetAddress)
throws java.net.SocketException
- Binds this socket to a local port.
_bind
static int _bind(int sd,
byte[] ipAddress,
int port)
close
public void close()
- Closes this socket.
_close
static int _close(int sd)
peek
public int peek(java.net.InetAddress sender) throws java.io.IOException
- Polls until a datagram packet is received. Once received, the parameter
sender is populated with the address of the sender and the
port number is returned as an
int. Note that the JDK1.4 API documentation states that the IP address should be returned as anint- however, the JDK1.1 API documentation states that the port number should be returned. I have implemented the JDK1.1 behaviour because it seems more sensible - an IP address is always stored in anInetAddressobject in Java.
peekData
public int peekData(java.net.DatagramPacket p) throws java.io.IOException
- Extracts the next DatagramPacket and returns the port number. Note
that the behaviour differs from that described in the JDK1.4
documentation.
receive
public void receive(java.net.DatagramPacket dgram) throws java.io.IOException
- Reads a datagram packet.
_receive
static void _receive(int sd,
java.net.DatagramPacket dgram,
int flags)
send
public void send(java.net.DatagramPacket dgram) throws java.io.IOException
- Sends a datagram packet.
_send
static void _send(int sd,
byte[] ipAddress,
int port,
byte[] data,
int length)
getTimeToLive
public int getTimeToLive()
throws java.io.IOException
- Retrieves time-to-live for multicast sockets.
NB Multicast sockets are not yet supported.
getTTL
public byte getTTL()
throws java.io.IOException
- Retrieves time-to-live for multicast sockets.
NB Multicast sockets are not yet supported.
The method leads to a deprecation warning in JDK1.3 but has to be
provided if
java.net.DatagramSocketImplis to be extended.
join
public void join(java.net.InetAddress groupAddr) throws java.io.IOException
- Joins a multicast group. (JDK1.3)
NB Multicast sockets are not yet supported.
joinGroup
public void joinGroup(java.net.SocketAddress mcastaddr, java.net.NetworkInterface netIf) throws java.io.IOException
- Joins a multicast group. (JDK1.4)
NB Multicast sockets are not yet supported.
leave
public void leave(java.net.InetAddress groupAddr) throws java.io.IOException
- Leaves a multicast group. (JDK1.3)
NB Multicast sockets are not yet supported.
leaveGroup
public void leaveGroup(java.net.SocketAddress mcastaddr, java.net.NetworkInterface netIf) throws java.io.IOException
- Leaves a multicast group. (JDK1.4)
NB Multicast sockets are not yet supported.
setTimeToLive
public void setTimeToLive(int ttl)
throws java.io.IOException
- Sets time-to-live for multicast sockets.
NB Multicast sockets are not yet supported.
setTTL
public void setTTL(byte ttl)
throws java.io.IOException
- Sets time-to-live for multicast sockets.
NB Multicast sockets are not yet supported.
The method leads to a deprecation warning in JDK1.3 but has to be
provided if
java.net.DatagramSocketImplis to be extended.
getSocketDescriptor
public static int getSocketDescriptor(java.io.FileDescriptor fd)
- Gets the socket descriptor from a
java.io.FileDescriptorobject. NB Java provides no public access to the value of the descriptor so it has to be extracted using native code.
_getSocketDescriptor
static int _getSocketDescriptor(java.io.FileDescriptor fd)
setSocketDescriptor
public static void setSocketDescriptor(java.io.FileDescriptor fd, int sd)
- Sets the socket descriptor for a
java.io.FileDescriptorobject. NB Java provides no public access to the descriptor so its value has to be set using native code.
_setSocketDescriptor
static void _setSocketDescriptor(java.io.FileDescriptor fd, int sd)
setOption
public void setOption(int optID,
java.lang.Object value)
throws java.net.SocketException
- Sets the value of a socket option. The value has to be an
Integerobject.
_setOption
static int _setOption(int socketDescriptor,
int optionName,
java.lang.Object newValue)
getOption
public java.lang.Object getOption(int optID) throws java.net.SocketException
- Gets the value of a socket option. The returned value will be an
Integerobject.
_getOption
static java.lang.Object _getOption(int socketDescriptor, int optionName) throws java.net.SocketException
|
|||||||||
| Home >> All >> com >> act365 >> [ net overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC