KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > net > DatagramSocketFactory


1 /*
2  * Copyright 2001-2005 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.commons.net;
17
18 import java.net.DatagramSocket JavaDoc;
19 import java.net.InetAddress JavaDoc;
20 import java.net.SocketException JavaDoc;
21
22 /***
23  * The DatagramSocketFactory interface provides a means for the
24  * programmer to control the creation of datagram sockets and
25  * provide his own DatagramSocket implementations for use by all
26  * classes derived from
27  * {@link org.apache.commons.net.DatagramSocketClient}
28  * .
29  * This allows you to provide your own DatagramSocket implementations and
30  * to perform security checks or browser capability requests before
31  * creating a DatagramSocket.
32  * <p>
33  * <p>
34  * @author Daniel F. Savarese
35  ***/

36
37 public interface DatagramSocketFactory
38 {
39
40     /***
41      * Creates a DatagramSocket on the local host at the first available port.
42      * <p>
43      * @exception SocketException If the socket could not be created.
44      ***/

45     public DatagramSocket JavaDoc createDatagramSocket() throws SocketException JavaDoc;
46
47     /***
48      * Creates a DatagramSocket on the local host at a specified port.
49      * <p>
50      * @param port The port to use for the socket.
51      * @exception SocketException If the socket could not be created.
52      ***/

53     public DatagramSocket JavaDoc createDatagramSocket(int port) throws SocketException JavaDoc;
54
55     /***
56      * Creates a DatagramSocket at the specified address on the local host
57      * at a specified port.
58      * <p>
59      * @param port The port to use for the socket.
60      * @param laddr The local address to use.
61      * @exception SocketException If the socket could not be created.
62      ***/

63     public DatagramSocket JavaDoc createDatagramSocket(int port, InetAddress JavaDoc laddr)
64     throws SocketException JavaDoc;
65 }
66
Popular Tags