public class SocksServerSocket
extends java.net.ServerSocket
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
localHost |
protected java.net.InetAddress |
localIP |
protected int |
localPort |
protected Proxy |
proxy |
| Constructor and Description |
|---|
SocksServerSocket(java.net.InetAddress ip,
int port)
Creates ServerSocket capable of accepting one connection
through the firewall, uses default Proxy.
|
SocksServerSocket(Proxy p,
java.net.InetAddress ip,
int port)
Creates ServerSocket capable of accepting one connection
through the firewall, uses given proxy.
|
SocksServerSocket(Proxy p,
java.lang.String host,
int port)
Creates ServerSocket capable of accepting one connection
through the firewall, uses given proxy.
|
SocksServerSocket(java.lang.String host,
int port)
Creates ServerSocket capable of accepting one connection
through the firewall, uses default Proxy.
|
| Modifier and Type | Method and Description |
|---|---|
java.net.Socket |
accept()
Accepts the incoming connection.
|
void |
close()
Closes the connection to proxy if socket have not been accepted, if
the direct connection is used, closes direct ServerSocket.
|
java.lang.String |
getHost()
Get the name of the host proxy is using to listen for incoming
connection.
|
java.net.InetAddress |
getInetAddress()
Get address assigned by proxy to listen for incomming
connections, or the local machine address if doing direct
connection.
|
int |
getLocalPort()
Get port assigned by proxy to listen for incoming connections, or
the port chosen by local system, if accepting directly.
|
void |
setSoTimeout(int timeout)
Set Timeout.
|
protected Proxy proxy
protected java.lang.String localHost
protected java.net.InetAddress localIP
protected int localPort
public SocksServerSocket(java.lang.String host,
int port)
throws SocksException,
java.net.UnknownHostException,
java.io.IOException
host - Host from which the connection should be recieved.port - Port number of the primary connection.SocksExceptionjava.net.UnknownHostExceptionjava.io.IOExceptionpublic SocksServerSocket(Proxy p, java.lang.String host, int port) throws SocksException, java.net.UnknownHostException, java.io.IOException
p - Proxy object to use.host - Host from which the connection should be recieved.port - Port number of the primary connection.SocksExceptionjava.net.UnknownHostExceptionjava.io.IOExceptionpublic SocksServerSocket(java.net.InetAddress ip,
int port)
throws SocksException,
java.io.IOException
ip - Host from which the connection should be recieved.port - Port number of the primary connection.SocksExceptionjava.io.IOExceptionpublic SocksServerSocket(Proxy p, java.net.InetAddress ip, int port) throws SocksException, java.io.IOException
p - Proxy object to use.ip - Host from which the connection should be recieved.port - Port number of the primary connection.SocksExceptionjava.io.IOExceptionpublic java.net.Socket accept()
throws java.io.IOException
accept in class java.net.ServerSocketjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.net.ServerSocketjava.io.IOExceptionpublic java.lang.String getHost()
Usefull when address is returned by proxy as the hostname.
public java.net.InetAddress getInetAddress()
getInetAddress in class java.net.ServerSocketpublic int getLocalPort()
getLocalPort in class java.net.ServerSocketpublic void setSoTimeout(int timeout)
throws java.net.SocketException
setSoTimeout in class java.net.ServerSockettimeout - Amount of time in milliseconds, accept should wait for
incoming connection before failing with exception.
Zero timeout implies infinity.java.net.SocketExceptionCopyright © 2012. All Rights Reserved.