Solved

NetworkStream.DataAvailable returns false

Posted on 2008-06-20
1
1,882 Views
Last Modified: 2013-12-16
NetworkStream.DataAvailable occasionally returns false, even when the complete data has not arrived.
Is there any workaround for this issue.
0
Comment
Question by:psniranjan
1 Comment
 
LVL 15

Accepted Solution

by:
ozymandias earned 500 total points
ID: 21837207
DataAvailable is not a blocking call like receive is.
It will return false if there is no data available at the precise moment it is called, it is therefore not a reliable method for determining if the remote client had finished sending.

You are better of using Receive() with a timeout and waiting for it to return 0 bytes or if data available returns false go into a timed loop that checks for data available for a given period (i.e. a timeout just like Receive()).
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to reference objects of the calling class without passing them as parameters 29 177
.net and XML report from SCCM 5 25
Media.Imaging 1 18
C# Desktop Application 3 36
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa‚Ķ

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question