KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > codehaus > spice > netserve > sockets > impl > DefaultSocketFactory


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.impl;
9
10 import java.io.IOException JavaDoc;
11 import java.net.InetAddress JavaDoc;
12 import java.net.Socket JavaDoc;
13 import org.codehaus.spice.netserve.sockets.SocketFactory;
14
15 /**
16  * A SocketFactory that creates vanilla 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="SocketFactory"
22  */

23 public class DefaultSocketFactory
24     implements SocketFactory
25 {
26     /**
27      * Create a socket that connects to specified remote address.
28      *
29      * @param address the remote address
30      * @param port the remote port
31      * @return the socket connected to remote address
32      * @throws IOException if unable to create socket
33      */

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

51     public Socket JavaDoc createSocket( final InetAddress JavaDoc address,
52                                 final int port,
53                                 final InetAddress JavaDoc localAddress,
54                                 final int localPort )
55         throws IOException JavaDoc
56     {
57         return new Socket JavaDoc( address, port, localAddress, localPort );
58     }
59 }
60
Popular Tags