KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > codehaus > spice > netserve > sockets > SocketFactory


1 /*
2  * Copyright (C) The Spice Group. All rights reserved.
3  *
4  * This software is published under the terms of the Spice
5  * Software License version 1.1, a copy of which has been included
6  * with this distribution in the LICENSE.txt file.
7  */

8 package org.codehaus.spice.netserve.sockets;
9
10 import java.io.IOException JavaDoc;
11 import java.net.InetAddress JavaDoc;
12 import java.net.Socket JavaDoc;
13
14 /**
15  * Service used to create client 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 SocketFactory
24 {
25     /**
26      * Create a socket that connects to specified remote address.
27      *
28      * @param address the remote address
29      * @param port the remote port
30      * @return the socket connected to remote address
31      * @throws IOException if unable to create socket
32      */

33     Socket JavaDoc createSocket( InetAddress JavaDoc address, int port )
34         throws IOException JavaDoc;
35
36     /**
37      * Create a socket that connects to specified remote address and
38      * originates from specified local address.
39      *
40      * @param address the remote address
41      * @param port the remote port
42      * @param localAddress the local address
43      * @param localPort the local port
44      * @return the socket connected to remote address
45      * @throws IOException if unable to create socket
46      */

47     Socket JavaDoc createSocket( InetAddress JavaDoc address, int port,
48                          InetAddress JavaDoc localAddress, int localPort )
49         throws IOException JavaDoc;
50 }
51
Popular Tags