[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

NetworkStream.DataAvailable returns false

Posted on 2008-06-20
1
Medium Priority
?
2,060 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 1500 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

872 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