KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > net > ServerSocketFactory


1 /*
2  * @(#)ServerSocketFactory.java 1.10 04/02/16
3  *
4  * Copyright (c) 2004 Sun Microsystems, Inc. All Rights Reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7   
8 /*
9  * NOTE:
10  * Because of various external restrictions (i.e. US export
11  * regulations, etc.), the actual source code can not be provided
12  * at this time. This file represents the skeleton of the source
13  * file, so that javadocs of the API can be created.
14  */

15
16 package javax.net;
17
18 import java.io.IOException;
19 import java.net.InetAddress;
20 import java.net.ServerSocket;
21 import java.net.SocketException;
22
23 /**
24  * This class creates server sockets. It may be subclassed by other
25  * factories, which create particular types of server sockets. This
26  * provides a general framework for the addition of public socket-level
27  * functionality. It is the server side analogue of a socket factory,
28  * and similarly provides a way to capture a variety of policies related
29  * to the sockets being constructed.
30  *
31  * <P> Like socket factories, server Socket factory instances have
32  * methods used to create sockets. There is also an environment
33  * specific default server socket factory; frameworks will often use
34  * their own customized factory.
35  *
36  * @since 1.4
37  * @see SocketFactory
38  *
39  * @version 1.19
40  * @author David Brownell
41  */

42 public abstract class ServerSocketFactory
43 {
44
45     /**
46      * Creates a server socket factory.
47      */

48     protected ServerSocketFactory() { }
49
50     /**
51      * Returns a copy of the environment's default socket factory.
52      *
53      * @return the <code>ServerSocketFactory</code>
54      */

55     public static ServerSocketFactory getDefault() {
56         return null;
57     }
58
59     /**
60      * Returns an unbound server socket. The socket is configured with
61      * the socket options (such as accept timeout) given to this factory.
62      *
63      * @return the unbound socket
64      * @throws IOException if the socket cannot be created
65      * @see java.net.ServerSocket#bind(java.net.SocketAddress)
66      * @see java.net.ServerSocket#bind(java.net.SocketAddress, int)
67      * @see java.net.ServerSocket#ServerSocket()
68      */

69     public ServerSocket createServerSocket() throws IOException {
70         return null;
71     }
72
73     /**
74      * Returns a server socket bound to the specified port.
75      * The socket is configured with the socket options
76      * (such as accept timeout) given to this factory.
77      *
78      * @param port the port to listen to
79      * @return the <code>ServerSocket</code>
80      * @exception IOException for networking errors
81      * @see java.net.ServerSocket#ServerSocket(int)
82      */

83     public abstract ServerSocket createServerSocket(int port)
84         throws IOException;
85
86     /**
87      * Returns a server socket bound to the specified port, and uses the
88      * specified connection backlog. The socket is configured with
89      * the socket options (such as accept timeout) given to this factory.
90      *
91      * @param port the port to listen to
92      * @param backlog how many connections are queued
93      * @return the <code>ServerSocket</code>
94      * @exception IOException for networking errors
95      * @see java.net.ServerSocket#ServerSocket(int, int)
96      */

97     public abstract ServerSocket createServerSocket(int port, int backlog)
98         throws IOException;
99
100     /**
101      * Returns a server socket bound to the specified port,
102      * with a specified listen backlog and local IP.
103      * The bindAddr argument can be used on a multi-homed host for a
104      * <code>ServerSocket</code> that will only accept
105      * connect requests to one
106      * of its addresses. The socket is configured
107      * with the socket options (such as accept timeout) given to this factory.
108      *
109      * @param port the port to listen to
110      * @param backlog how many connections are queued
111      * @param ifAddress the network interface address to use
112      * @return the <code>ServerSocket</code>
113      * @exception IOException for networking errors
114      * @see java.net.ServerSocket#ServerSocket(int, int, java.net.InetAddress)
115      */

116     public abstract ServerSocket createServerSocket(int port, int backlog,
117         InetAddress ifAddress) throws IOException;
118 }
119
Popular Tags