public interface LowLevelSocket
Modifier and Type | Method and Description |
---|---|
int |
connect(long resourceId,
java.lang.String host,
int port)
Establish a connection to the given host and port.
|
int |
connectSSL(long resourceId,
java.lang.String host,
int port,
boolean nosessionreuse,
boolean nohostverify)
Establish a SSL connection to the given host and port.
|
boolean |
disconnect(int id)
Disconnect this socket.
|
long |
getBytesAvailable(int id)
Get the available bytes to be read.
|
boolean |
getKeepAlive(int id)
Get the SO_KEEPALIVE option value for this socket.
|
java.lang.String |
getLocalHost(int id)
Get the IP address of this side of this connection.
|
int |
getLocalPort(int id)
Get the port number of this side of this connection.
|
int |
getReceiveBufferSize(int id)
Get the SO_RCVBUF option value for this socket.
|
java.lang.String |
getRemoteHost(int id)
Get the host IP address of the remote side of this connection.
|
int |
getRemotePort(int id)
Get the port number of the remote side of this connection.
|
boolean |
getReuseAddress(int id)
Get the SO_REUSEADDR option value for this socket.
|
int |
getSendBufferSize(int id)
Get the SO_SNDBUF option value for this socket.
|
int |
getSoLinger(int id)
Get the SO_LINGER option value for this socket.
|
int |
getSoTimeout(int id)
Get the SO_RCVTIMEO option value for this socket.
|
java.lang.String |
getSslServerName(int id)
In case of a SSL connection, get the digital certificate subject name of the server for
the current SSL session; else, return
null . |
boolean |
getTcpNoDelay(int id)
Get the TCP_NODELAY option value for this socket.
|
boolean |
isConnected(int id)
Check if the java socket is still connected.
|
long |
read(int id,
memptr buffer,
long pos,
long len,
int mode)
Java implementation for the READ() SOCKET method, this will read the specified number of
bytes from the available data on the socket, and put it inside the memory buffer
argument at the specified position.
|
void |
setKeepAlive(int id,
boolean on)
Set the SO_KEEPALIVE option for this socket.
|
void |
setReceiveBufferSize(int id,
int size)
Set the SO_RCVBUF value (the receive buffer size) for this socket.
|
void |
setReuseAddress(int id,
boolean on)
Set the SO_REUSEADDR option for this socket.
|
void |
setSendBufferSize(int id,
int size)
Set the SO_SNDBUF value (the send buffer size) for this socket.
|
void |
setSoLinger(int id,
boolean on,
int linger)
Set the SO_LINGER option for this socket.
|
void |
setSoTimeout(int id,
int timeout)
Set the SO_RCVTIMEO value (the number of seconds the socket waits to receive data before
timing out) for this socket.
|
void |
setTcpNoDelay(int id,
boolean on)
Set the TCP_NODELAY option for this socket.
|
long |
write(int id,
memptr buffer,
long pos,
long len)
Java implementation for the WRITE() SOCKET method, this will write data from the specified
buffer location (position and number of bytes) to the socket.
|
int connect(long resourceId, java.lang.String host, int port) throws java.io.IOException
resourceId
- The ID of the associated SocketImpl
resource on server side.host
- The IP address or name of the target host.port
- The port number.java.io.IOException
- In case of errors while establishing the connection.int connectSSL(long resourceId, java.lang.String host, int port, boolean nosessionreuse, boolean nohostverify) throws java.io.IOException, java.security.GeneralSecurityException
resourceId
- The ID of the associated SocketImpl
resource on server side.host
- The IP address or name of the target host.port
- The port number.nosessionreuse
- Flag indicating that the ssl session ID must not be reused.nohostverify
- Flag indicating that the target host name must not be validated against the
certificate's principal name.java.io.IOException
- In case of errors while establishing the connection.java.security.GeneralSecurityException
- In case of errors while establishing the SSL connection.boolean isConnected(int id)
id
- The ID of the associated socket on P2J Client side.true
if the java socket is still connected.boolean disconnect(int id)
id
- The ID of the associated socket on P2J Client side.true
if no errors were encountered during disconnect.long getBytesAvailable(int id)
id
- The ID of the associated socket on P2J Client side.long read(int id, memptr buffer, long pos, long len, int mode) throws java.io.IOException
Optionally the read mode can be set by the following values:
id
- The ID of the associated socket on P2J Client side.buffer
- The memory buffer where read() puts the data.pos
- The position in the memory buffer where the data is added.len
- The number of bytes to read from the socket.mode
- The mode to set for the reading operation.java.io.IOException
- In case IO errors were encoubtered during read.long write(int id, memptr buffer, long pos, long len) throws java.io.IOException
id
- The ID of the associated socket on P2J Client side.buffer
- The memory buffer from which the data will be written to the socket.pos
- The position in the memory buffer from where the data to be taken starts.len
- The number of bytes to take from the memory buffer.java.io.IOException
- In case IO errors were encoubtered during write.java.lang.String getSslServerName(int id)
null
.id
- The ID of the associated socket on P2J Client side.boolean getTcpNoDelay(int id) throws java.net.SocketException
Socket.getTcpNoDelay()
for more details.id
- The ID of the associated socket on P2J Client side.java.net.SocketException
- If the socket option could not be interrogated.int getSoLinger(int id) throws java.net.SocketException
Socket.getSoLinger()
for more details.id
- The ID of the associated socket on P2J Client side.java.net.SocketException
- If the socket option could not be interrogated.boolean getKeepAlive(int id) throws java.net.SocketException
Socket.getKeepAlive()
for more details.id
- The ID of the associated socket on P2J Client side.java.net.SocketException
- If the socket option could not be interrogated.boolean getReuseAddress(int id) throws java.net.SocketException
Socket.getReuseAddress()
for more details.id
- The ID of the associated socket on P2J Client side.java.net.SocketException
- If the socket option could not be interrogated.int getReceiveBufferSize(int id) throws java.net.SocketException
Socket.getReceiveBufferSize()
for more details.id
- The ID of the associated socket on P2J Client side.java.net.SocketException
- If the socket option could not be interrogated.int getSendBufferSize(int id) throws java.net.SocketException
Socket.getSendBufferSize()
for more details.id
- The ID of the associated socket on P2J Client side.java.net.SocketException
- If the socket option could not be interrogated.int getSoTimeout(int id) throws java.net.SocketException
Socket.getSoTimeout()
for more details.id
- The ID of the associated socket on P2J Client side.java.net.SocketException
- If the socket option could not be interrogated.void setTcpNoDelay(int id, boolean on) throws java.net.SocketException
Socket.setTcpNoDelay(boolean)
for more details.id
- The ID of the associated socket on P2J Client side.on
- The TCP_NODELAY value.java.net.SocketException
- If the socket option could not be set.void setSoLinger(int id, boolean on, int linger) throws java.net.SocketException
Socket.setSoLinger(boolean, int)
for more details.id
- The ID of the associated socket on P2J Client side.on
- true
to turn on the SO_LINGER option.linger
- The linger time.java.net.SocketException
- If the socket option could not be set.void setKeepAlive(int id, boolean on) throws java.net.SocketException
Socket.setKeepAlive(boolean)
for more details.id
- The ID of the associated socket on P2J Client side.on
- The SO_KEEPALIVE value.java.net.SocketException
- If the socket option could not be set.void setReuseAddress(int id, boolean on) throws java.net.SocketException
Socket.setReuseAddress(boolean)
for more details.id
- The ID of the associated socket on P2J Client side.on
- The SO_REUSEADDR value.java.net.SocketException
- If the socket option could not be set.void setReceiveBufferSize(int id, int size) throws java.net.SocketException
Socket.setReceiveBufferSize(int)
for more details.id
- The ID of the associated socket on P2J Client side.size
- The SO_RCVBUF value.java.net.SocketException
- If the socket option could not be set.void setSendBufferSize(int id, int size) throws java.net.SocketException
Socket.setSendBufferSize(int)
for more details.id
- The ID of the associated socket on P2J Client side.size
- The SO_SNDBUF value.java.net.SocketException
- If the socket option could not be set.void setSoTimeout(int id, int timeout) throws java.net.SocketException
Socket.setSoTimeout(int)
for more details.id
- The ID of the associated socket on P2J Client side.timeout
- The SO_RCVTIMEO value.java.net.SocketException
- If the socket option could not be set.java.lang.String getLocalHost(int id)
id
- The ID of the associated socket on P2J Client side.int getLocalPort(int id)
id
- The ID of the associated socket on P2J Client side.java.lang.String getRemoteHost(int id)
id
- The ID of the associated socket on P2J Client side.int getRemotePort(int id)
id
- The ID of the associated socket on P2J Client side.