Turn.Server.TcpFramingHeader.GetBytes C# (CSharp) Method

GetBytes() public static method

public static GetBytes ( byte bytes, int offset, TcpFrameType frameType, int length ) : void
bytes byte
offset int
frameType TcpFrameType
length int
return void
        public static void GetBytes(byte[] bytes, int offset, TcpFrameType frameType, int length)
        {
            bytes[offset + 0] = (byte)frameType;
            bytes[offset + 1] = 0;
            Array.Copy(((UInt16)length).GetBigendianBytes(), 0, bytes, offset + 2, 2);
        }

Usage Example

Example #1
0
        private void GetBuffer(ServerEndPoint local, IPEndPoint remote, int length, out ServerAsyncEventArgs e, out int offset)
        {
            int headerLength = (local.Protocol == ServerProtocol.Tcp) ? TcpFramingHeader.TcpFramingHeaderLength : 0;

            e = EventArgsManager.Get();

            e.ConnectionId   = ServerAsyncEventArgs.AnyConnectionId;
            e.LocalEndPoint  = local;
            e.RemoteEndPoint = remote;
            e.Count          = headerLength + length;
            e.AllocateBuffer();

            if (headerLength > 0)
            {
                TcpFramingHeader.GetBytes(e.Buffer, e.Offset, TcpFrameType.ControlMessage, length);
            }

            offset = e.Offset + headerLength;
        }
All Usage Examples Of Turn.Server.TcpFramingHeader::GetBytes
TcpFramingHeader