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.impl;
09:
10: import java.io.IOException;
11: import java.net.InetAddress;
12: import java.net.ServerSocket;
13: import org.codehaus.spice.netserve.sockets.ServerSocketFactory;
14:
15: /**
16: * Factory implementation for vanilla TCP sockets.
17: *
18: * @author Peter Donald
19: * @version $Revision: 1.2 $ $Date: 2004/03/21 23:42:59 $
20: * @dna.component
21: * @dna.service type="ServerSocketFactory"
22: */
23: public class DefaultServerSocketFactory implements 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: public ServerSocket createServerSocket(final int port)
32: throws IOException {
33: return new ServerSocket(port);
34: }
35:
36: /**
37: * Creates a socket on specified port with a specified backlog.
38: *
39: * @param port the port (0 indicates any available port)
40: * @param backlog the backlog
41: * @return the created ServerSocket
42: * @throws IOException if unable to create socket
43: */
44: public ServerSocket createServerSocket(int port, int backlog)
45: throws IOException {
46: return new ServerSocket(port, backlog);
47: }
48:
49: /**
50: * Creates a socket on a particular network interface on specified port
51: * with a specified backlog.
52: *
53: * @param port the port (0 indicates any available port)
54: * @param backlog the backlog
55: * @param address the network interface to bind to.
56: * @return the created ServerSocket
57: * @throws IOException if unable to create socket
58: */
59: public ServerSocket createServerSocket(int port, int backlog,
60: InetAddress address) throws IOException {
61: return new ServerSocket(port, backlog, address);
62: }
63: }
|