Extends MultiplexingDatagramSocket from SafeCloseDatagramSocket.

This commit is contained in:
lubomir.marinov 2010-02-15 18:01:24 +00:00
parent 9606ced6ec
commit 986a66f3b2
2 changed files with 50 additions and 1 deletions

View File

@ -21,7 +21,7 @@ import java.util.*;
* @author Lubomir Marinov
*/
public class MultiplexingDatagramSocket
extends DatagramSocket
extends SafeCloseDatagramSocket
{
/**

View File

@ -35,6 +35,21 @@ public class SafeCloseDatagramSocket
*/
private final Object inReceiveSyncRoot = new Object();
/**
* Initializes a new <tt>SafeCloseDatagramSocket</tt> instance and binds it
* to any available port on the local host machine. The socket will be
* bound to the wildcard address, an IP address chosen by the kernel.
*
* @throws SocketException if the socket could not be opened, or the socket
* could not bind to the specified local port
* @see DatagramSocket#DatagramSocket()
*/
public SafeCloseDatagramSocket()
throws SocketException
{
super();
}
/**
* Creates a datagram socket, bound to the specified local socket address.
* <p>
@ -52,6 +67,40 @@ public class SafeCloseDatagramSocket
super(bindaddr);
}
/**
* Initializes a new <tt>SafeCloseDatagramSocket</tt> instance and binds it
* to the specified port on the local host machine. The socket will be
* bound to the wildcard address, an IP address chosen by the kernel.
*
* @param port the port to bind the new socket to
* @throws SocketException if the socket could not be opened, or the socket
* could not bind to the specified local port
* @see DatagramSocket#DatagramSocket(int)
*/
public SafeCloseDatagramSocket(int port)
throws SocketException
{
super(port);
}
/**
* Initializes a new <tt>SafeCloseDatagramSocket</tt> instance bound to the
* specified local address. The local port must be between 0 and 65535
* inclusive. If the IP address is 0.0.0.0, the socket will be bound to the
* wildcard address, an IP address chosen by the kernel.
*
* @param port the local port to bind the new socket to
* @param laddr the local address to bind the new socket to
* @throws SocketException if the socket could not be opened, or the socket
* could not bind to the specified local port
* @see DatagramSocket#DatagramSocket(int, InetAddress)
*/
public SafeCloseDatagramSocket(int port, InetAddress laddr)
throws SocketException
{
super(port, laddr);
}
/**
* Closes this datagram socket.
* <p>