01: /*
02: * Copyright (C) The Spice Group. All rights reserved.
03: *
04: * This software is published under the terms of the Spice
05: * Software License version 1.1, a copy of which has been included
06: * with this distribution in the LICENSE.txt file.
07: */
08: package org.codehaus.spice.netserve.sockets;
09:
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: * Creates a socket on specified port.
26: *
27: * @param port the port (0 indicates any available port)
28: * @return the created ServerSocket
29: * @throws IOException if unable to create socket
30: */
31: ServerSocket createServerSocket(int port) throws IOException;
32:
33: /**
34: * Creates a socket on specified port with a specified backlog.
35: *
36: * @param port the port (0 indicates any available port)
37: * @param backlog the backlog
38: * @return the created ServerSocket
39: * @throws IOException if unable to create socket
40: */
41: ServerSocket createServerSocket(int port, int backlog)
42: throws IOException;
43:
44: /**
45: * Creates a socket on a particular network interface on specified port
46: * with a specified backlog.
47: *
48: * @param port the port (0 indicates any available port)
49: * @param backlog the backlog
50: * @param address the network interface to bind to.
51: * @return the created ServerSocket
52: * @throws IOException if unable to create socket
53: */
54: ServerSocket createServerSocket(int port, int backlog,
55: InetAddress address) throws IOException;
56: }
|