Here is my method:
private byte ReadNetworkStream(NetworkStream networkStream, int buffer)
ArrayList arrayList = new ArrayList();
byte readBuffer = new byte[buffer];
int bytesRead = 0;
// Incoming message may be larger than the buffer size.
bytesRead = networkStream.Read(readBuffer, 0, buffer);
if (bytesRead == buffer)
else if (bytesRead > 0 && bytesRead < buffer)
byte endRead = new byte[bytesRead];
Array.Copy(readBuffer, endRead, bytesRead);
But it doesn't work. (I don't want to use Encoding, because I only want binary datas)
Thanks in advance for your help.