103 references to SocketOptionLevel
netstandard (1)
netstandard.cs (1)
1276
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Net.Sockets.
SocketOptionLevel
))]
System (1)
src\libraries\shims\System\ref\System.cs (1)
766
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Net.Sockets.
SocketOptionLevel
))]
System.Net.Ping (1)
System\Net\NetworkInformation\Ping.RawSocket.cs (1)
89
socket.SetSocketOption(
SocketOptionLevel
.IP, SocketOptionName.HeaderIncluded, 1);
System.Net.Requests (3)
System\Net\HttpWebRequest.cs (3)
1777
socket.SetSocketOption(
SocketOptionLevel
.Socket, SocketOptionName.KeepAlive, true);
1778
socket.SetSocketOption(
SocketOptionLevel
.Tcp, SocketOptionName.TcpKeepAliveTime, keepAlive.Time);
1779
socket.SetSocketOption(
SocketOptionLevel
.Tcp, SocketOptionName.TcpKeepAliveInterval, keepAlive.Interval);
System.Net.Sockets (97)
src\libraries\Common\src\Interop\Unix\System.Native\Interop.GetSockOpt.cs (2)
13
internal static unsafe partial Error GetSockOpt(SafeHandle socket,
SocketOptionLevel
optionLevel, SocketOptionName optionName, byte* optionValue, int* optionLen);
16
internal static unsafe partial Error GetSockOpt(IntPtr socket,
SocketOptionLevel
optionLevel, SocketOptionName optionName, byte* optionValue, int* optionLen);
src\libraries\Common\src\Interop\Unix\System.Native\Interop.SetSockOpt.cs (2)
13
internal static unsafe partial Error SetSockOpt(SafeHandle socket,
SocketOptionLevel
optionLevel, SocketOptionName optionName, byte* optionValue, int optionLen);
16
internal static unsafe partial Error SetSockOpt(IntPtr socket,
SocketOptionLevel
optionLevel, SocketOptionName optionName, byte* optionValue, int optionLen);
System\Net\Sockets\NetworkStream.cs (4)
123
int timeout = (int)_streamSocket.GetSocketOption(
SocketOptionLevel
.Socket, SocketOptionName.ReceiveTimeout)!;
150
int timeout = (int)_streamSocket.GetSocketOption(
SocketOptionLevel
.Socket, SocketOptionName.SendTimeout)!;
699
_streamSocket.SetSocketOption(
SocketOptionLevel
.Socket, SocketOptionName.SendTimeout, timeout, silent);
708
_streamSocket.SetSocketOption(
SocketOptionLevel
.Socket, SocketOptionName.ReceiveTimeout, timeout, silent);
System\Net\Sockets\SafeSocketHandle.Unix.cs (6)
58
internal void TrackOption(
SocketOptionLevel
level, SocketOptionName name)
63
case
SocketOptionLevel
.Tcp:
70
case
SocketOptionLevel
.IP:
78
case
SocketOptionLevel
.IPv6:
86
case
SocketOptionLevel
.Socket:
208
Interop.Error err = Interop.Sys.GetSockOpt(handle,
SocketOptionLevel
.Socket, SocketOptionName.Type, (byte*)&type, &optLen);
System\Net\Sockets\Socket.cs (49)
500
return (int)GetSocketOption(
SocketOptionLevel
.Socket, SocketOptionName.ExclusiveAddressUse)! != 0 ? true : false;
508
SetSocketOption(
SocketOptionLevel
.Socket, SocketOptionName.ExclusiveAddressUse, value ? 1 : 0);
516
return (int)GetSocketOption(
SocketOptionLevel
.Socket, SocketOptionName.ReceiveBuffer)!;
522
SetSocketOption(
SocketOptionLevel
.Socket, SocketOptionName.ReceiveBuffer, value);
530
return (int)GetSocketOption(
SocketOptionLevel
.Socket, SocketOptionName.SendBuffer)!;
537
SetSocketOption(
SocketOptionLevel
.Socket, SocketOptionName.SendBuffer, value);
546
return (int)GetSocketOption(
SocketOptionLevel
.Socket, SocketOptionName.ReceiveTimeout)!;
557
SetSocketOption(
SocketOptionLevel
.Socket, SocketOptionName.ReceiveTimeout, value);
566
return (int)GetSocketOption(
SocketOptionLevel
.Socket, SocketOptionName.SendTimeout)!;
578
SetSocketOption(
SocketOptionLevel
.Socket, SocketOptionName.SendTimeout, value);
589
return (LingerOption?)GetSocketOption(
SocketOptionLevel
.Socket, SocketOptionName.Linger);
595
SetSocketOption(
SocketOptionLevel
.Socket, SocketOptionName.Linger, value!);
603
return (int)GetSocketOption(
SocketOptionLevel
.Tcp, SocketOptionName.NoDelay)! != 0 ? true : false;
607
SetSocketOption(
SocketOptionLevel
.Tcp, SocketOptionName.NoDelay, value ? 1 : 0);
617
return (short)(int)GetSocketOption(
SocketOptionLevel
.IP, SocketOptionName.IpTimeToLive)!;
621
return (short)(int)GetSocketOption(
SocketOptionLevel
.IPv6, SocketOptionName.IpTimeToLive)!;
637
SetSocketOption(
SocketOptionLevel
.IP, SocketOptionName.IpTimeToLive, value);
642
SetSocketOption(
SocketOptionLevel
.IPv6, SocketOptionName.IpTimeToLive, value);
659
return (int)GetSocketOption(
SocketOptionLevel
.IP, SocketOptionName.DontFragment)! != 0 ? true : false;
673
SetSocketOption(
SocketOptionLevel
.IP, SocketOptionName.DontFragment, value ? 1 : 0);
692
return (int)GetSocketOption(
SocketOptionLevel
.IP, SocketOptionName.MulticastLoopback)! != 0 ? true : false;
696
return (int)GetSocketOption(
SocketOptionLevel
.IPv6, SocketOptionName.MulticastLoopback)! != 0 ? true : false;
709
SetSocketOption(
SocketOptionLevel
.IP, SocketOptionName.MulticastLoopback, value ? 1 : 0);
714
SetSocketOption(
SocketOptionLevel
.IPv6, SocketOptionName.MulticastLoopback, value ? 1 : 0);
731
return (int)GetSocketOption(
SocketOptionLevel
.Socket, SocketOptionName.Broadcast)! != 0 ? true : false;
736
SetSocketOption(
SocketOptionLevel
.Socket, SocketOptionName.Broadcast, value ? 1 : 0);
756
return ((int)GetSocketOption(
SocketOptionLevel
.IPv6, SocketOptionName.IPv6Only)! == 0);
767
SetSocketOption(
SocketOptionLevel
.IPv6, SocketOptionName.IPv6Only, value ? 0 : 1);
2080
public void SetSocketOption(
SocketOptionLevel
optionLevel, SocketOptionName optionName, int optionValue)
2088
public void SetSocketOption(
SocketOptionLevel
optionLevel, SocketOptionName optionName, byte[] optionValue)
2107
public void SetSocketOption(
SocketOptionLevel
optionLevel, SocketOptionName optionName, bool optionValue)
2113
public void SetSocketOption(
SocketOptionLevel
optionLevel, SocketOptionName optionName, object optionValue)
2120
if (optionLevel ==
SocketOptionLevel
.Socket && optionName == SocketOptionName.Linger)
2133
else if (optionLevel ==
SocketOptionLevel
.IP && (optionName == SocketOptionName.AddMembership || optionName == SocketOptionName.DropMembership))
2142
else if (optionLevel ==
SocketOptionLevel
.IPv6 && (optionName == SocketOptionName.AddMembership || optionName == SocketOptionName.DropMembership))
2166
/// The <see cref="SetRawSocketOption"/> should be used only when <see cref="
SocketOptionLevel
"/> and <see cref="SocketOptionName"/>
2184
public object? GetSocketOption(
SocketOptionLevel
optionLevel, SocketOptionName optionName)
2187
if (optionLevel ==
SocketOptionLevel
.Socket && optionName == SocketOptionName.Linger)
2191
else if (optionLevel ==
SocketOptionLevel
.IP && (optionName == SocketOptionName.AddMembership || optionName == SocketOptionName.DropMembership))
2195
else if (optionLevel ==
SocketOptionLevel
.IPv6 && (optionName == SocketOptionName.AddMembership || optionName == SocketOptionName.DropMembership))
2221
public void GetSocketOption(
SocketOptionLevel
optionLevel, SocketOptionName optionName, byte[] optionValue)
2244
public byte[] GetSocketOption(
SocketOptionLevel
optionLevel, SocketOptionName optionName, int optionLength)
2286
/// The <see cref="GetRawSocketOption"/> should be used only when <see cref="
SocketOptionLevel
"/> and <see cref="SocketOptionName"/>
2316
SocketPal.SetIPProtectionLevel(this,
SocketOptionLevel
.IPv6, (int)level);
2320
SocketPal.SetIPProtectionLevel(this,
SocketOptionLevel
.IP, (int)level);
3460
SocketOptionLevel
.Socket,
3574
SetSocketOption(
SocketOptionLevel
.IP, SocketOptionName.PacketInformation, true);
3585
SetSocketOption(
SocketOptionLevel
.IPv6, SocketOptionName.PacketInformation, true);
3592
internal void SetSocketOption(
SocketOptionLevel
optionLevel, SocketOptionName optionName, int optionValue, bool silent)
System\Net\Sockets\SocketPal.Unix.cs (16)
78
error = Interop.Sys.SetSockOpt(fd,
SocketOptionLevel
.IPv6, SocketOptionName.IPv6Only, (byte*)&on, sizeof(int));
1421
private static SocketError GetErrorAndTrackSetting(SafeSocketHandle handle,
SocketOptionLevel
optionLevel, SocketOptionName optionName, Interop.Error err)
1431
public static unsafe SocketError SetSockOpt(SafeSocketHandle handle,
SocketOptionLevel
optionLevel, SocketOptionName optionName, int optionValue)
1435
if (optionLevel ==
SocketOptionLevel
.Socket)
1450
else if (optionLevel ==
SocketOptionLevel
.IP)
1476
if (optionLevel ==
SocketOptionLevel
.IPv6 && optionName == SocketOptionName.IPv6Only)
1502
public static unsafe SocketError SetSockOpt(SafeSocketHandle handle,
SocketOptionLevel
optionLevel, SocketOptionName optionName, byte[] optionValue)
1552
return GetErrorAndTrackSetting(handle,
SocketOptionLevel
.IP, optionName, err);
1569
return GetErrorAndTrackSetting(handle,
SocketOptionLevel
.IPv6, optionName, err);
1580
return GetErrorAndTrackSetting(handle,
SocketOptionLevel
.Socket, SocketOptionName.Linger, err);
1589
socket.SetSocketOption(
SocketOptionLevel
.IP, SocketOptionName.PacketInformation, true);
1594
public static void SetIPProtectionLevel(Socket socket,
SocketOptionLevel
optionLevel, int protectionLevel)
1600
public static unsafe SocketError GetSockOpt(SafeSocketHandle handle,
SocketOptionLevel
optionLevel, SocketOptionName optionName, out int optionValue)
1602
if (optionLevel ==
SocketOptionLevel
.Socket)
1643
public static unsafe SocketError GetSockOpt(SafeSocketHandle handle,
SocketOptionLevel
optionLevel, SocketOptionName optionName, byte[] optionValue, ref int optionLength)
2191
SocketError errorCode = GetSockOpt(handle,
SocketOptionLevel
.Socket, SocketOptionName.Error, out int optionValue);
System\Net\Sockets\TCPClient.cs (8)
308
get { return (int)Client.GetSocketOption(
SocketOptionLevel
.Socket, SocketOptionName.ReceiveBuffer)!; }
309
set { Client.SetSocketOption(
SocketOptionLevel
.Socket, SocketOptionName.ReceiveBuffer, value); }
315
get { return (int)Client.GetSocketOption(
SocketOptionLevel
.Socket, SocketOptionName.SendBuffer)!; }
316
set { Client.SetSocketOption(
SocketOptionLevel
.Socket, SocketOptionName.SendBuffer, value); }
325
return (int)Client.GetSocketOption(
SocketOptionLevel
.Socket, SocketOptionName.ReceiveTimeout)!;
330
Client.SetSocketOption(
SocketOptionLevel
.Socket, SocketOptionName.ReceiveTimeout, value);
340
return (int)Client.GetSocketOption(
SocketOptionLevel
.Socket, SocketOptionName.SendTimeout)!;
345
Client.SetSocketOption(
SocketOptionLevel
.Socket, SocketOptionName.SendTimeout, value);
System\Net\Sockets\UDPClient.cs (10)
262
_clientSocket.SetSocketOption(
SocketOptionLevel
.Socket, SocketOptionName.Broadcast, 1);
408
SocketOptionLevel
.IP,
415
SocketOptionLevel
.IPv6,
431
SocketOptionLevel
.IP,
451
SocketOptionLevel
.IPv6,
472
(_family == AddressFamily.InterNetwork) ?
SocketOptionLevel
.IP :
SocketOptionLevel
.IPv6,
492
SocketOptionLevel
.IP,
499
SocketOptionLevel
.IPv6,
519
SocketOptionLevel
.IPv6,