public class SocksServerSocket extends ServerSocket
Modifier and Type | Field and Description |
---|---|
protected String |
localHost |
protected InetAddress |
localIP |
protected int |
localPort |
protected Proxy |
proxy |
Constructor and Description |
---|
SocksServerSocket(InetAddress ip,
int port)
Creates ServerSocket capable of accepting one connection
through the firewall, uses default Proxy.
|
SocksServerSocket(Proxy p,
InetAddress ip,
int port)
Creates ServerSocket capable of accepting one connection
through the firewall, uses given proxy.
|
SocksServerSocket(Proxy p,
String host,
int port)
Creates ServerSocket capable of accepting one connection
through the firewall, uses given proxy.
|
SocksServerSocket(String host,
int port)
Creates ServerSocket capable of accepting one connection
through the firewall, uses default Proxy.
|
Modifier and Type | Method and Description |
---|---|
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.
|
String |
getHost()
Get the name of the host proxy is using to listen for incoming
connection.
|
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.
|
bind, bind, getChannel, getLocalSocketAddress, getReceiveBufferSize, getReuseAddress, getSoTimeout, implAccept, isBound, isClosed, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSocketFactory, toString
protected Proxy proxy
protected String localHost
protected InetAddress localIP
protected int localPort
public SocksServerSocket(String host, int port) throws SocksException, UnknownHostException, IOException
host
- Host from which the connection should be recieved.port
- Port number of the primary connection.SocksException
UnknownHostException
IOException
public SocksServerSocket(Proxy p, String host, int port) throws SocksException, UnknownHostException, IOException
p
- Proxy object to use.host
- Host from which the connection should be recieved.port
- Port number of the primary connection.SocksException
UnknownHostException
IOException
public SocksServerSocket(InetAddress ip, int port) throws SocksException, IOException
ip
- Host from which the connection should be recieved.port
- Port number of the primary connection.SocksException
IOException
public SocksServerSocket(Proxy p, InetAddress ip, int port) throws SocksException, IOException
p
- Proxy object to use.ip
- Host from which the connection should be recieved.port
- Port number of the primary connection.SocksException
IOException
public Socket accept() throws IOException
accept
in class ServerSocket
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class ServerSocket
IOException
public String getHost()
Usefull when address is returned by proxy as the hostname.
public InetAddress getInetAddress()
getInetAddress
in class ServerSocket
public int getLocalPort()
getLocalPort
in class ServerSocket
public void setSoTimeout(int timeout) throws SocketException
setSoTimeout
in class ServerSocket
timeout
- Amount of time in milliseconds, accept should wait for
incoming connection before failing with exception.
Zero timeout implies infinity.SocketException
Copyright © 2024. All rights reserved.