About zero-byte receive (IOCP server)
- From: "Kürşat" <xx@xxxxxx>
- Date: Tue, 27 Nov 2007 17:10:12 +0200
Hi,
As you already know I work hard to develop a robust IOCP server with your
help :)
My new issue is about zero-byte receives. From my researches,I have learned
that to overcome WSAENOBUF problem (the one caused by large amount of locked
memory) I should post a receive with zero-length buffer for every accepted
client. On completion of that receive I can post actual receive and read
data. But how? How should I call WSARecv () at that point to read data
efficiently (Blocking, non-blocking or posting to completion port)?
A book says : "...once the zero-byte receive operation completes, the server
can simply perform a non-blocking receive to retrieve all the data buffered
in the socket's receive buffer. There is no more data pending when the
non-blocking receive fails with WSAEWOULDBLOCK..."
As far as understand the excerpt, I should make the socket non-blocking
everytime a zero-byte receive completes for that socket by using
ioctlsocket (...). Then I should read data by calling WSARecv () until
WSAGetLastError () returns WSAEWOULDBLOCK. After that I should post another
zero-byte read using same socket. But I have made the socket non-blocking,
does it prevent using same socket with overlapped calls to WSARecv () which
I use to post zero-byte receive? Why should I make non-blocking calls to
read actual data instead of posting to completion port?
I know, nature of the communication between clients and server determine
answers to obove questions but your general advices could help me to find
most appropriate way to implement this part of my server.
Thanks in advance.
.
- Prev by Date: Re: TCP retransmission
- Next by Date: Re: TCP retransmission
- Previous by thread: Re: Two Networks
- Next by thread: Re: About zero-byte receive (IOCP server)
- Index(es):
Relevant Pages
|
Loading