Login  
Search All Forums
Dart Home | PowerTCP Sockets for .NET | Custom Development Reply | PowerTCP Sockets for .NET (Secure and Standard) Topics | Forums   
AuthorForum: PowerTCP Sockets for .NET (Secure and Standard)
Topic: Possibility of truncated response
zemackdaddy

From: Salt Lake City, UT USA
Posts: 6
Member Since: 03/07/03
posted May 22, 2003 11:20 AM

We wrote this code based on the usage of the component in the sample code supplied with the component:

StringBuilder sbRes = new StringBuilder();
while(tcp.Connected) {
sbRes.Append(tcp.Receive().ToString());
}
sResponseXml = sbRes.ToString();

Occaisionally, the response is truncated, resulting in misformed XML. However, all appears to be good from the sender's perspective. We suspect that perhaps the above code is truncating the response, or not receiving all of it...?

Is there ever any chance using this approach that some of the response may not be received before the component is no longer connected? Is there a more recommended or safer way to collect all of the response?
K M Drake



From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted May 23, 2003 11:05 AM

Hi,
No, that should be ok - a closed state should not be reached while there is data available.

Is the data always received in its entiretly if you change the conditional to not rely on Tcp.Connected?

There are other, higher level ways to recognize the end of the data - some protocols use a terminating sequence, others a data count, etc.

-ken
Reply | PowerTCP Sockets for .NET (Secure and Standard) Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX