IOCP problem.

June 23rd, 2004 - 11:47 pm ET by peng jianrong | Report spam
hi, i found that if the client uses IOCP, it cannot detect the network
failure. so it always thinks that the network is good.

for examples, you run both client and server in different computers which
connected each other via a switcher. if you disconnect the server computer
from the network by unpluging the network cable, the client won't know
this( the function
GetQueuedCompletionStatus will block for ever), so it doesn't know when it
should close the socket for the network failure. but if you disconnect the
client computer from the network, the client will known this.(the function
GetQueuedCompletionStatus will return 0, and lpOverlapped!=NULL, which means
IO failed). i don't know how to deal with it, even if i set the tcp option
SO_KEEPALIVE, it doesn't work.

Does anybody have any good solution for me? i don't want to send heartbeat
message to keep it alive. if anybody can help me, please send an email to
me.
peng-jr@21cn.com thanks in advance.
email Follow the discussionReplies 1 replyReplies Make a reply

Similar topics

Replies

#1 Arkady Frenkel
June 24th, 2004 - 03:31 am ET | Report spam
But IOCP is server model not client .
OTOH you do can check network disconnection by different methods (
programmable ping e.g. ) , you can do it from different thread and send
PostQueuedCompletionStatus() with some special packet to awake waiting
thread and finish it.
Arkady

"peng jianrong" wrote in message
news:
hi, i found that if the client uses IOCP, it cannot detect the network
failure. so it always thinks that the network is good.

for examples, you run both client and server in different computers which
connected each other via a switcher. if you disconnect the server computer
from the network by unpluging the network cable, the client won't know
this( the function
GetQueuedCompletionStatus will block for ever), so it doesn't know when it
should close the socket for the network failure. but if you disconnect the
client computer from the network, the client will known this.(the function
GetQueuedCompletionStatus will return 0, and lpOverlapped!=NULL, which


means
IO failed). i don't know how to deal with it, even if i set the tcp option
SO_KEEPALIVE, it doesn't work.

Does anybody have any good solution for me? i don't want to send heartbeat
message to keep it alive. if anybody can help me, please send an email to
me.
thanks in advance.




email Follow the discussion Replies Reply to this message
Help Create a new topicReplies Make a reply
Search Make your own search