Screenary.TransportClient.RecvAll C# (CSharp) Method

RecvAll() private method

private RecvAll ( Socket socket, byte buffer, int offset, int size ) : void
socket Socket
buffer byte
offset int
size int
return void
        private void RecvAll(Socket socket, byte[] buffer, int offset, int size)
        {
            int recv = 0;
            int total_recv = 0;
            int end = offset + size;

            while (offset < end)
            {
                try
                {
                    recv = socket.Receive(buffer, offset, (size - total_recv), 0);
                    total_recv += recv;
                    offset += recv;
                }
                catch (SocketException e)
                {
                    throw new TransportException("Error receiving from Socket");
                }
            }
        }