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
Question has a verified solution.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
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()).