1
2
3
4
5
6
7
8 package org.codehaus.spice.netserve.sockets;
9
10 import java.io.IOException;
11 import java.net.InetAddress;
12 import java.net.ServerSocket;
13
14 /***
15 * Service used to create server sockets. The factory is used so that
16 * the exact socket type and underlying transport is abstracted. The
17 * sockets created could be proxied, SSL enabled, TLS enabled etc.
18 * However clients just care that they return sockets.
19 *
20 * @author Peter Donald
21 * @version $Revision: 1.2 $ $Date: 2004/03/21 23:43:00 $
22 */
23 public interface ServerSocketFactory
24 {
25 /***
26 * Creates a socket on specified port.
27 *
28 * @param port the port (0 indicates any available port)
29 * @return the created ServerSocket
30 * @throws IOException if unable to create socket
31 */
32 ServerSocket createServerSocket( int port )
33 throws IOException;
34
35 /***
36 * Creates a socket on specified port with a specified backlog.
37 *
38 * @param port the port (0 indicates any available port)
39 * @param backlog the backlog
40 * @return the created ServerSocket
41 * @throws IOException if unable to create socket
42 */
43 ServerSocket createServerSocket( int port, int backlog )
44 throws IOException;
45
46 /***
47 * Creates a socket on a particular network interface on specified port
48 * with a specified backlog.
49 *
50 * @param port the port (0 indicates any available port)
51 * @param backlog the backlog
52 * @param address the network interface to bind to.
53 * @return the created ServerSocket
54 * @throws IOException if unable to create socket
55 */
56 ServerSocket createServerSocket( int port, int backlog, InetAddress address )
57 throws IOException;
58 }
59