[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2135
  • Last Modified:

NetworkStream.DataAvailable returns false

NetworkStream.DataAvailable occasionally returns false, even when the complete data has not arrived.
Is there any workaround for this issue.
0
psniranjan
Asked:
psniranjan
1 Solution
 
ozymandiasCommented:
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now