| 
 |   | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
This interface is used as a heap to control the allocation of sockets.
An instance of this interface can be passed to methods that allocate sockets. In this way, the actual, underlying type of socket allocated can be replaced (for instance, with an SSL socket or an firewall-tunnelling socket), without the user of the socket having to explicitly be aware of the underlying implementation.
 In some ways, this class is a replacement for the
 SocketImplFactory class.  This class addresses the following
 issues. 
SocketImplFactory may be installed only once for the entire
 process, so different policies cannot be used concurrently and/or
 consectively.  For instance, imagine a situation where the user wants one
 part of the program talking via SSL to some port on machine A and via
 standard sockets to some port on machine B.  It is not possible to
 install separate SocketImplFactory objects to allow both.
 Socket class presumes a highly-connected network
 with the ability to resolve hostnames to IP addresses.  The standard
 Socket class always converts the hostname to an IP address
 before calling SocketImplFactory.  If the hostname does not
 have an IP address, then the SocketImplFactory never gets a
 chance to intercept the host name and perform alternate routing based on
 the name.  For instance, imagine that the user has implemented a
 firewall-tunnelling socket; the raw hostname must be passed to the
 firewall machine, which allows the socket to be established once some
 out-of-band credentials are supplied.  But we could never get this far
 because the standard Socket class would have already rejected
 the request since the IP address of the target machine was unknown.
 
| Field Summary | |
| static SocketFactory | defaultFactoryThe default socket factory. | 
| Method Summary | |
|  Socket | newSocket(String host,
          int port)Creates a new Socketthat talks to the specified port
 on the named host. | 
| Field Detail | 
public static final SocketFactory defaultFactory
Socket to the specified host and port, and is exactly
 equivalent to calling new Socket(host, port).
| Method Detail | 
public Socket newSocket(String host,
                        int port)
                 throws IOException
Socket that talks to the specified port
 on the named host.
 
 The implementation may choose any way it wants to provide a
 socket-like object (essentially any mechanism that supports
 bidirectional communication).  The returned Socket (or
 subclass of Socket) might not be based on TCP/IP, or it
 might involve running a TCP/IP stack over some other protocol, or it
 might actually redirect all connections via some other proxy machine,
 etc.
host - The host name.port - The port number.
IOException - If there is some problem establishing the socket to the
		specified port on the named host.| 
 | Version 2.1, Generated 12/30/04 Copyright (c) 2001-2004, Sun Microsystems. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||