How to raise ReadTiemoutException when not receive the response in 2 seconds after sending the request to Server

Binh Duong binhduongthanh at yahoo.com
Wed May 12 07:21:21 EDT 2010


Hi All,

I am newbie to Netty (just study the framework for 3 days but need to
finished the task by week :-( ) So I really need your help to realize the
below scenario.
I need develop a Client Socket which runs 24/7 to connect to a Socket
Server. After connecting successfully, the Client shall:
1. In the fix internal of time (e.g 30 seconds) if there is no other message
send to the Server the Client will send to the Server a B1 message and wait
for the response from the Server (It is just a Ping message).
2. If the Client does not receive the response from the Server in 2 seconds
after sending the B1 message, it will try to send the B1 message again. If
after 3 times retry to send the B1 message, it will close the current
connection and try to open a new connection.
So my question is:
1. How to send a B1 message after there is no communication between the
Client-Server in 30 seconds? Can I use the IdleStateHandler for READER_IDLE
state?
2. How to raise the ReadTimeoutException after sending the B1 message to
Server in 2 seconds? Can I add the ReaderTimeoutHandler to the pipe line
right after send the B1 message and remove it after I receive the response
for the Server?
3. The communication between the Client and Server is an array of one-byte
character (JIS8) so I can use ChannelBuffer for sending and receiving the
messages, right?

Thanks in advance,
Binh

-- 
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/How-to-raise-ReadTiemoutException-when-not-receive-the-response-in-2-seconds-after-sending-the-requer-tp5040649p5040649.html
Sent from the Netty User Group mailing list archive at Nabble.com.


More information about the netty-users mailing list