示例#1
0
        private static int ReceiveBlock(Socket s, out byte[] data)
        {
            // Type
            int type = BitConverter.ToInt32(s.ReceiveAll(4), 0);

            // Length
            int len = BitConverter.ToInt32(s.ReceiveAll(4), 0);

            // Value
            data = len > 0 ? s.ReceiveAll(len) : new byte[0];

            return type;
        }