Inter Character Timeout for SocketChannel
Hi,
I am using java.nio to implement the HSMS communication protocols which use TCP/IP link.
In HSMS there is a requirement to implement the Inter Character Timeout. Means, the time delay between the reciept of two consecutive bytes on the TCP link has to be within some limit.
1. Is there any parameter to be set to specify this timeout value ?
2. how to capture an timeout error in this regard.
thanks in advace
Amit
# 1
SocketChannel.socket().setSoTimeout() sets a read timeout in milliseconds. If you are in blocking mode and the timer expires while you're reading, a java.net.SocketTimeoutException is raised, although the socket and channel remain valid.
ejpa at 2007-7-12 14:49:53 >

# 2
>SocketChannel.socket().setSoTimeout() sets a read timeout in >milliseconds
thanks for your responce but this suggests its the time duration for which the channel will attempt to read the incoming stream of Bytes.
This does not indicate anything about the time lag between two successive bytes of the incoming stream.
regards
Amit
# 3
That's just up to how often you can call the read() method. If there is data already arrived the read will return immediately, otherwise it will wait for up to the timeout and return with whatever data arrives next, which will probably be a single IP packet, or, if you're lucky, a single complete TCP segment. If you process that data and get back to calling the read method within the inter-character timeout period, just subtract your processing latency from the next read timeout. If you can't process the data quickly enough, you don't really have a reason to care about the inter-character timeout, and even if you do there is no solution available other than reducing your processing latency. This is the only data timeout available in TCP/IP.
ejpa at 2007-7-12 14:49:53 >
