In the following scenario;
System.Net.Sockets.TcpClient TC = SomeHowObtained;
System.Net.Sockets.NetworkStream NS = TC.GetStream();
Is there any difference between using NS.DataAvailable and checking TC.Available > 0?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In this case no, there is no difference. Internally
NS.DataAvailablereturns true whenSocket.Available != 0. SinceTC.Availablejust returnSocket.Availableand you are checking if that is greater than 0 you are basically doing the same thing.