?
Solved

NetworkStream.DataAvailable returns false

Posted on 2008-06-20
1
Medium Priority
?
1,974 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

770 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