Article View: borland.public.cppbuilder.internet.socket
Article #1135Re: Why would the socket not receive all the data?
From: Paul at NCF
Date: Mon, 26 Mar 2007 10:20
Date: Mon, 26 Mar 2007 10:20
44 lines
2951 bytes
2951 bytes
Thanks. Further questions below: "Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message news:4606f07a$1@newsgroups.borland.com... > Because the socket's internal receive buffer may not have enough room > to hold all of the inbound data at one time. Also, network latency > can cause the socket to timeout internally and return whatever is > currently in its buffer even if it isn't completely full yet. So, is it possible to have one end send and have the send appear to be successful, but the other end not receive all of it or none of it? Other than the expected length field (if implemented), can the receiver tell if the payload is fully received or not? Does the WinSock layer provide data that is in sequence as and when its available? eg. the TCP/IP protocol makes sure data is received in the right order and uncorrupted, so if a payload takes say 100 packets, and if it receives packets 1-50, will it send it to the socket handler read layer, or does it wait for the whole 100 packets? Does the number of routers / firewalls in the chain affect behaviour (other than latency)? > The only way that can happen is if you have multiple threads writing > to, or reading from, the same socket at the same time without > serializing their access to the socket to prevent concurrent > operations. We were thinking of putting some more protocol headers and footers on the payload to make sure the data is fully received and uncorrupted. The system in place is rather large and very busy, the number of packets per day that get corrupted is quite low, but the impact when it happens can be quite high. I think the socket handling thread is written generically and is reading data in and offloading it to another level up for processing. If there is something wrong with the reading process and its not detecting an error (eg. socket timeout), then the next level up will get the start of the next message and not realise it. Thanks in advance. Paul
Technical Details
Message-ID:
<46079e5f$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4606d0c4$1@newsgroups.borland.com> <4606f07a$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,56c8fbfda2c57917 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Paul at NCF" <notplmacca@clara.co.uk> Newsgroups: borland.public.cppbuilder.internet.socket References: <4606d0c4$1@newsgroups.borland.com> <4606f07a$1@newsgroups.borland.com> Subject: Re: Why would the socket not receive all the data? Date: Mon, 26 Mar 2007 11:20:12 +0100 Lines: 46 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3028 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 81.155.187.174 Message-ID: <46079e5f$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1174904415 81.155.187.174 (26 Mar 2007 03:20:15 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail