|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.acplt.oncrpc.OncRpcTcpSocketHelper
Wraps JRE-specific networking code for TCP/IP-based client sockets. So much for compile once, make it unuseable everywhere. Why could our great Sun simply not get their socket class straight from the beginning? The BSD socket API has been around since long enough and that real network applications need to control certain aspects of the transport layer's behaviour was also well known at this time -- looks like the one exceptions was -- and still is -- Sun, and the second one is MS.
Sun always toutes Java as the perfect network "whatever" (reflace with buzzword-of-the-day, like "programming language", "operating system",...) and especially their support for the Web. Sweet irony that it took them until JRE 1.3 to realize that half-closed connections are the way to do HTTP/1.0 non-persistent connections.
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):
Field Summary | |
private java.lang.reflect.Method |
methodGetReceiveBufferSize
Method Socket.getReceiveBufferSize or null if not available
in the class library of a particular JRE. |
private java.lang.reflect.Method |
methodGetSendBufferSize
Method Socket.getSendBufferSize or null if not available
in the class library of a particular JRE. |
private java.lang.reflect.Method |
methodSetReceiveBufferSize
Method Socket.setReceiverBufferSize or null if not available
in the class library of a particular JRE. |
private java.lang.reflect.Method |
methodSetSendBufferSize
Method Socket.setSendBufferSize or null if not available
in the class library of a particular JRE. |
private java.net.Socket |
socket
The socket for which we have to help out with some missing methods. |
Constructor Summary | |
OncRpcTcpSocketHelper(java.net.Socket socket)
Creates a stream socket using the TCP/IP protocol and connects it to the specified port number on the named host. |
Method Summary | |
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 Socket 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. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private java.net.Socket socket
private java.lang.reflect.Method methodSetSendBufferSize
null
if not available
in the class library of a particular JRE.private java.lang.reflect.Method methodSetReceiveBufferSize
null
if not available
in the class library of a particular JRE.private java.lang.reflect.Method methodGetSendBufferSize
null
if not available
in the class library of a particular JRE.private java.lang.reflect.Method methodGetReceiveBufferSize
null
if not available
in the class library of a particular JRE.Constructor Detail |
public OncRpcTcpSocketHelper(java.net.Socket socket)
Method Detail |
public void setSendBufferSize(int size) throws java.net.SocketException
size
- The size to which to set the send buffer size. This value
must be greater than 0.size
is 0 or negative.public int getSendBufferSize() throws java.net.SocketException
public void setReceiveBufferSize(int size) throws java.net.SocketException
size
- The size to which to set the receive buffer size. This value
must be greater than 0.size
is 0 or negative.public int getReceiveBufferSize() throws java.net.SocketException
protected void queryMethods()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |