🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
1 messages
1 total messages Started by Paul at NCF Sun, 25 Mar 2007 19:43
Why would the socket not receive all the data?
#1231
Author: Paul at NCF
Date: Sun, 25 Mar 2007 19:43
45 lines
2288 bytes
Hi,

Not sure if this is the right forum, but here goes.  This is more fact 
finding than a specific problem.

In many examples, the socket read is done by reading a length (sizeof(int)) 
and then reading the size of the data (length).

The sender sends the length field and the following payload data.

Both of these operations are usually done in a while loop, re-sending and 
re-receiving based on the return value (size read).

My questions are:

1)  Why would the reading/receive not recieve all the data in one go?  ie. 
why does the read need to be in a loop?

2)  Ditto write/sending?

3)  Is it to do with the WinSock layer?

4)  If the data is sent or received in small chunks, are they random in size 
or meaning, or are they really based on some low level protocol packet 
(ethernet or IP, TCP, etc)?

Reason for asking is that we have recently come across problems on some of 
our equipment where one message appears to be part recieved, and then 
another message is overlaid on top of it (half way through).  eg.

Normally:
        a55a, length field, payload number of bytes msg1
        a55a, length field, payload number of bytes msg2
        ....

Sometimes we are seeing:

        a55a, length field, some bytes, a55a, length field, some of msg 2 
payload (up to length of msg1)

Help appreciated.

Regards,

Paul
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads