1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.commons.net;
17
18 import java.net.DatagramSocket;
19 import java.net.InetAddress;
20 import java.net.SocketException;
21
22 /***
23 * The DatagramSocketFactory interface provides a means for the
24 * programmer to control the creation of datagram sockets and
25 * provide his own DatagramSocket implementations for use by all
26 * classes derived from
27 * {@link org.apache.commons.net.DatagramSocketClient}
28 * .
29 * This allows you to provide your own DatagramSocket implementations and
30 * to perform security checks or browser capability requests before
31 * creating a DatagramSocket.
32 * <p>
33 * <p>
34 * @author Daniel F. Savarese
35 ***/
36
37 public interface DatagramSocketFactory
38 {
39
40 /***
41 * Creates a DatagramSocket on the local host at the first available port.
42 * <p>
43 * @exception SocketException If the socket could not be created.
44 ***/
45 public DatagramSocket createDatagramSocket() throws SocketException;
46
47 /***
48 * Creates a DatagramSocket on the local host at a specified port.
49 * <p>
50 * @param port The port to use for the socket.
51 * @exception SocketException If the socket could not be created.
52 ***/
53 public DatagramSocket createDatagramSocket(int port) throws SocketException;
54
55 /***
56 * Creates a DatagramSocket at the specified address on the local host
57 * at a specified port.
58 * <p>
59 * @param port The port to use for the socket.
60 * @param laddr The local address to use.
61 * @exception SocketException If the socket could not be created.
62 ***/
63 public DatagramSocket createDatagramSocket(int port, InetAddress laddr)
64 throws SocketException;
65 }