I am trying to read all data present in the buffer of the Machine connected through TCP/IP
but i don't know why i am not getting all data ,some data is getting Missed.
Here is the code that i am using ..
using (NetworkStream stream = client.GetStream())
{
byte[] data = new byte[1024];
int numBytesRead = stream.Read(data, 0, data.Length);
if (numBytesRead > 0)
{
string str= Encoding.ASCII.GetString(data, 0, numBytesRead);
}
}
Please tell me what i am missing to get all the data from the machine. Thanks in advance..
NetworkStream.DataAvailable
. – ShockproofGeorgeChond
.Is his code more meaningfull in comparison to mine – Littoral