Doing a Socket.Receive(byte[]) will get the bytes in from the buffer, but if the expected data is fairly large, all of the bytes might not yet be in the buffer, which would
No, Receive
returns number of received bytes. You should properly handle this.
var needBytes = message_byte.Length;
var receivedBytes;
var totalReceivedBytes = 0;
do
{
receivedBytes = sock.Receive(message_byte, totalReceivedBytes, needBytes, SocketFlags.None);
needBytes -= receivedBytes;
totalReceivedBytes += receivedBytes;
} while (needBytes > 0 && receivedBytes > 0)