Shvalb
May 10th, 2009, 01:23 PM
Hi,
In order to build a server I use IOCP by calling AcceptEx() and bind every socket by calling 'BindIoCompletionCallback()'.
When Client connects and sends a message I receive it by calling 'ReadFile()'.
Now for my problem:
I defined buffer of size 1024 for 'AcceptEx' and for 'ReadFile' .
and if, for instance, the Client sends the Server a buffer of size 2500 bytes, it gets it in small chunks:
960 bytes
960 bytes
580 bytes
which is great - until now everything works great, BUT!! if the Client sends another buffer of 2500 bytes the Sever, for some reason, gets it by chunks of 580 bytes (which is the exact size which he got the last chunk of the previous buffer) instead of getting it by chunks of 960 bytes.
btw: 960 is because : 1024 - sizeof(sockaddr_in)+16)*2
and this goes on and on it reads very small chunks and never goes back to reading 960 bytes, any idea why?? what am I doing wrong ??
Hope I made myself clear,
Thanks for reading and paying attention.
BYE.
In order to build a server I use IOCP by calling AcceptEx() and bind every socket by calling 'BindIoCompletionCallback()'.
When Client connects and sends a message I receive it by calling 'ReadFile()'.
Now for my problem:
I defined buffer of size 1024 for 'AcceptEx' and for 'ReadFile' .
and if, for instance, the Client sends the Server a buffer of size 2500 bytes, it gets it in small chunks:
960 bytes
960 bytes
580 bytes
which is great - until now everything works great, BUT!! if the Client sends another buffer of 2500 bytes the Sever, for some reason, gets it by chunks of 580 bytes (which is the exact size which he got the last chunk of the previous buffer) instead of getting it by chunks of 960 bytes.
btw: 960 is because : 1024 - sizeof(sockaddr_in)+16)*2
and this goes on and on it reads very small chunks and never goes back to reading 960 bytes, any idea why?? what am I doing wrong ??
Hope I made myself clear,
Thanks for reading and paying attention.
BYE.