public static short ToInt16(ReadOnlySpan <byte> bytes)
 {
     return(IPAddress.NetworkToHostOrder(UnsafeBitConverter.ToInt16(bytes)));
 }
Exemplo n.º 2
0
 private static bool HasMagicCookie(ReadOnlyMemory <byte> bytes)
 {
     return(UnsafeBitConverter.ToInt32(bytes.Span.Slice(4, 4)) == StunMagicCookie);
 }
 public static void WriteBytes(Span <byte> destination, int value)
 {
     UnsafeBitConverter.WriteBytes(destination, IPAddress.HostToNetworkOrder(value));
 }
Exemplo n.º 4
0
 private void WriteMagicCookie(Span <byte> bytes)
 {
     UnsafeBitConverter.WriteBytes(bytes.Slice(4, 4), StunMagicCookie);
 }