public class OncRpcUdpSocketHelper extends Object
The following JRE-dependent methods are wrapped and will just do nothing or return fake information on old JRE plattforms. The number after each method wrapper indicates the first JRE version supporting a particular feature:
The following methods have been around since JDK 1.1, so we do not need to wrap them as we will never support JDK 1.0 -- let it rest in piece(s):
Constructor and Description |
---|
OncRpcUdpSocketHelper(DatagramSocket socket)
Creates a datagram socket and binds it to an arbitrary available port
on the local host machine.
|
Modifier and Type | Method and Description |
---|---|
int |
getReceiveBufferSize()
Get size of receive buffer for this socket.
|
int |
getSendBufferSize()
Get size of send buffer for this socket.
|
protected void |
queryMethods()
Looks up methods of class DatagramSocket whether they are supported
by the class libraries of the JRE we are currently executing on.
|
void |
setReceiveBufferSize(int size)
Sets the socket's receive buffer size as a hint to the underlying
transport layer to use appropriately sized I/O buffers.
|
void |
setSendBufferSize(int size)
Sets the socket's send buffer size as a hint to the underlying
transport layer to use appropriately sized I/O buffers.
|
public OncRpcUdpSocketHelper(DatagramSocket socket)
socket
- A datagram socket instancepublic void setSendBufferSize(int size) throws SocketException
size
- The size to which to set the send buffer size. This value
must be greater than 0.SocketException
- if the socket's send buffer size could not
be set, because the transport layer decided against accepting the
new buffer size.IllegalArgumentException
- if size
is 0 or negative.public int getSendBufferSize() throws SocketException
SocketException
- If the transport layer could not be queried
for the size of this socket's send buffer.public void setReceiveBufferSize(int size) throws SocketException
size
- The size to which to set the receive buffer size. This value
must be greater than 0.SocketException
- if the socket's receive buffer size could not
be set, because the transport layer decided against accepting the
new buffer size.IllegalArgumentException
- if size
is 0 or negative.public int getReceiveBufferSize() throws SocketException
SocketException
- If the transport layer could not be queried
for the size of this socket's receive buffer.protected void queryMethods()
Copyright © 2015. All rights reserved.