1
2
3
4
5
6
7
8 package org.codehaus.spice.netserve.sockets.impl;
9
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
24 implements ServerSocketFactory
25 {
26 /***
27 * Creates a socket on specified port.
28 *
29 * @param port the port (0 indicates any available port)
30 * @return the created ServerSocket
31 * @throws IOException if unable to create socket
32 */
33 public ServerSocket createServerSocket( final int port )
34 throws IOException
35 {
36 return new ServerSocket( port );
37 }
38
39 /***
40 * Creates a socket on specified port with a specified backlog.
41 *
42 * @param port the port (0 indicates any available port)
43 * @param backlog the backlog
44 * @return the created ServerSocket
45 * @throws IOException if unable to create socket
46 */
47 public ServerSocket createServerSocket( int port, int backlog )
48 throws IOException
49 {
50 return new ServerSocket( port, backlog );
51 }
52
53 /***
54 * Creates a socket on a particular network interface on specified port
55 * with a specified backlog.
56 *
57 * @param port the port (0 indicates any available port)
58 * @param backlog the backlog
59 * @param address the network interface to bind to.
60 * @return the created ServerSocket
61 * @throws IOException if unable to create socket
62 */
63 public ServerSocket createServerSocket( int port, int backlog, InetAddress address )
64 throws IOException
65 {
66 return new ServerSocket( port, backlog, address );
67 }
68 }
69