Project JXTA

net.jxta.impl.endpoint
Interface SocketFactory


public interface SocketFactory

Provides pluggable socket creation for JXTA TCP connection (not those for HTTP since those are from URLConnection).

The motivation for this class was to provide the ability to tunnel JXTA TCP through a web proxy but it could be used for other things as well. Call IPUtils.setSocketFactory() to configure JXTA to use a particular socket factory

Author:
Mike Sample

Method Summary
 Socket createConnection(InetAddress inetAddress, int port, InetAddress usingInterface, int localPort, int timeout)
          creates and returns a connected Socket.
 

Method Detail

createConnection

public Socket createConnection(InetAddress inetAddress,
                               int port,
                               InetAddress usingInterface,
                               int localPort,
                               int timeout)
                        throws IOException
creates and returns a connected Socket.

Parameters:
inetAddress - the destination IP address used to create an InetSocketAddress that will be used with the connect() call on the created socket.
port - the destination TCP port used to create an InetSocketAddress that will be used with the connect() call on the created socket.
usingInterface - the src (local) IP address used to create an InetSocketAddress to which the created socket will be bound via bind().
localPort - the src (local) TCP port used to create an InetSocketAddress to which the created socket will be bound via bind().
timeout - the time in milliseconds to be used with the socket.connect() call. A value of zero means infinite timeout.
Throws:
IOException

JXTA J2SE