CAsyncSocket and receive buffer length 
Author Message
 CAsyncSocket and receive buffer length

Hi all,

I have an application that uses a CAsyncSocket derived class to receive data from
a peer. The data is read from the buffer when an OnReceive notification is sent
by the framework to my application.In order to minimize data loss(in the case of
a crash), I want to set the receive buffer size to the size of one message length
so that there can be a maximum of 1 message loss . I do it with the
function "SetSockOpt" and see that it is set, but this does not generate the
behaviour I expect. My question is: : If the receive buffer is 1 message length
long and if the first message sent is not read by my application(so not removed
from the buffer), will TCP(Winsock) continue to send acks for the following
messages sent by the other application? If it does, when will it stop sending the
acks?

Thanks in advance.



Fri, 26 Sep 2003 14:44:12 GMT  
 CAsyncSocket and receive buffer length
TCP message size is independent of the data you send.  It is a stream
oriented protocol, so it does not know or care what size message you send.
TCP basically just says that if you send something it will get there in the
sequence that it was sent.  You need to embed Start, Stop, Message Length,
fields in your message so that your program can determine when you have
received a complete message.

To answer your question...

Quote:
>If the receive buffer is 1 message length
>long and if the first message sent is not read by my application(so not
removed
>from the buffer), will TCP(Winsock) continue to send acks for the following
>messages sent by the other application? If it does, when will it stop
sending the
>acks?

To the best of my knowledge...
If you do not remove the message from the buffer it will be overwritten by
the next message coming in.  TCP will continue to send acks as long as it
can communicate with your socket.


Hi all,

I have an application that uses a CAsyncSocket derived class to receive data
from
a peer. The data is read from the buffer when an OnReceive notification is
sent
by the framework to my application.In order to minimize data loss(in the
case of
a crash), I want to set the receive buffer size to the size of one message
length
so that there can be a maximum of 1 message loss . I do it with the
function "SetSockOpt" and see that it is set, but this does not generate the
behaviour I expect. My question is: : If the receive buffer is 1 message
length
long and if the first message sent is not read by my application(so not
removed
from the buffer), will TCP(Winsock) continue to send acks for the following
messages sent by the other application? If it does, when will it stop
sending the
acks?

Thanks in advance.



Fri, 26 Sep 2003 20:34:28 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Setting the receive buffer length does not work with CAsyncSocket

2. CAsyncSocket Send and Receive buffer

3. Control timeout period for a blocking CAsyncSocket's Send() and Receive()

4. WSAEFAULT error with CAsyncSocket::Receive() ???

5. CAsyncSocket: receive variable data?

6. Sending and receiving files trought CAsyncSocket derived class

7. CASyncSocket::Receive

8. CASyncSocket::Receive (does this really work?)

9. CAsyncSocket Receive

10. error 10055 from CAsyncSocket::Receive()

11. Control timeout period for a blocking CAsyncSocket's Send() and Receive()

12. Q: CAsyncSocket and Receive

 

 
Powered by phpBB® Forum Software