For some reason, the byte array output of BeginReceive fills up with nulls and then the data.
BeginReceive:
AsyncResult = connectSocket.BeginReceive(RecvBuffer2,
0, RecvBuffer2.Length,
SocketFlags.None,
OnDataRecvCallback, null);
Byte Array declaration:
public static byte[] RecvBuffer2 = new byte[9999];
How to remove the nulls and keep the rest of the data?
Should be doable with LINQ. Untested, since I don’t have Visual Studio available right now, but it should be something like this: