Exemple #1
0
 private static unsafe bool SetSocketOption<T>(SafeHandle handle, int level, CanSocketOption optName, ReadOnlySpan<T> data)
     where T : struct
 {
     int fd = (int)handle.DangerousGetHandle();
     ReadOnlySpan<byte> buf = MemoryMarshal.AsBytes(data);
     fixed (byte* pinned = buf)
     {
         return SetSocketOpt(fd, level, (int)optName, pinned, buf.Length) == 0;
     }
 }
Exemple #2
0
 public static bool SetCanRawSocketOption <T>(SafeHandle handle, CanSocketOption optName, ReadOnlySpan <T> data)
     where T : struct
 {
     return(SetSocketOption(handle, SOL_CAN_RAW, optName, data));
 }