135 references to SocketOptionName
netstandard (1)
netstandard.cs (1)
1277
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Net.Sockets.
SocketOptionName
))]
System (1)
src\libraries\shims\System\ref\System.cs (1)
767
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Net.Sockets.
SocketOptionName
))]
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 (129)
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 (13)
58
internal void TrackOption(SocketOptionLevel level,
SocketOptionName
name)
66
case
SocketOptionName
.NoDelay: _trackedOptions |= TrackedSocketOptions.NoDelay; return;
73
case
SocketOptionName
.DontFragment: _trackedOptions |= TrackedSocketOptions.DontFragment; return;
74
case
SocketOptionName
.IpTimeToLive: _trackedOptions |= TrackedSocketOptions.Ttl; return;
81
case
SocketOptionName
.IPv6Only: _trackedOptions |= TrackedSocketOptions.DualMode; return;
82
case
SocketOptionName
.IpTimeToLive: _trackedOptions |= TrackedSocketOptions.Ttl; return;
89
case
SocketOptionName
.Broadcast: _trackedOptions |= TrackedSocketOptions.EnableBroadcast; return;
90
case
SocketOptionName
.Linger: _trackedOptions |= TrackedSocketOptions.LingerState; return;
91
case
SocketOptionName
.ReceiveBuffer: _trackedOptions |= TrackedSocketOptions.ReceiveBufferSize; return;
92
case
SocketOptionName
.ReceiveTimeout: _trackedOptions |= TrackedSocketOptions.ReceiveTimeout; return;
93
case
SocketOptionName
.SendBuffer: _trackedOptions |= TrackedSocketOptions.SendBufferSize; return;
94
case
SocketOptionName
.SendTimeout: _trackedOptions |= TrackedSocketOptions.SendTimeout; return;
208
Interop.Error err = Interop.Sys.GetSockOpt(handle, SocketOptionLevel.Socket,
SocketOptionName
.Type, (byte*)&type, &optLen);
System\Net\Sockets\Socket.cs (57)
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
"/>
3461
SocketOptionName
.ReceiveTimeout,
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)
3595
if (OperatingSystem.IsWasi() && optionName ==
SocketOptionName
.PacketInformation)
3625
if (optionName ==
SocketOptionName
.PacketInformation && optionValue == 0 &&
3643
private void SetMulticastOption(
SocketOptionName
optionName, MulticastOption MR)
3657
private void SetIPv6MulticastOption(
SocketOptionName
optionName, IPv6MulticastOption MR)
3703
private MulticastOption? GetMulticastOpt(
SocketOptionName
optionName)
3720
private IPv6MulticastOption? GetIPv6MulticastOpt(
SocketOptionName
optionName)
System\Net\Sockets\SocketPal.Unix.cs (33)
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)
1437
if (optionName ==
SocketOptionName
.ReceiveTimeout)
1443
else if (optionName ==
SocketOptionName
.SendTimeout)
1452
if (optionName ==
SocketOptionName
.MulticastInterface)
1476
if (optionLevel == SocketOptionLevel.IPv6 && optionName ==
SocketOptionName
.IPv6Only)
1502
public static unsafe SocketError SetSockOpt(SafeSocketHandle handle, SocketOptionLevel optionLevel,
SocketOptionName
optionName, byte[] optionValue)
1532
public static unsafe SocketError SetMulticastOption(SafeSocketHandle handle,
SocketOptionName
optionName, MulticastOption optionValue)
1534
Debug.Assert(optionName ==
SocketOptionName
.AddMembership || optionName ==
SocketOptionName
.DropMembership, $"Unexpected optionName: {optionName}");
1536
Interop.Sys.MulticastOption optName = optionName ==
SocketOptionName
.AddMembership ?
1555
public static unsafe SocketError SetIPv6MulticastOption(SafeSocketHandle handle,
SocketOptionName
optionName, IPv6MulticastOption optionValue)
1557
Debug.Assert(optionName ==
SocketOptionName
.AddMembership || optionName ==
SocketOptionName
.DropMembership, $"Unexpected optionName={optionName}");
1559
Interop.Sys.MulticastOption optName = optionName ==
SocketOptionName
.AddMembership ?
1580
return GetErrorAndTrackSetting(handle, SocketOptionLevel.Socket,
SocketOptionName
.Linger, err);
1589
socket.SetSocketOption(SocketOptionLevel.IP,
SocketOptionName
.PacketInformation, true);
1600
public static unsafe SocketError GetSockOpt(SafeSocketHandle handle, SocketOptionLevel optionLevel,
SocketOptionName
optionName, out int optionValue)
1604
if (optionName ==
SocketOptionName
.ReceiveTimeout)
1609
else if (optionName ==
SocketOptionName
.SendTimeout)
1616
if (optionName ==
SocketOptionName
.Error)
1643
public static unsafe SocketError GetSockOpt(SafeSocketHandle handle, SocketOptionLevel optionLevel,
SocketOptionName
optionName, byte[] optionValue, ref int optionLength)
1653
else if (optionName ==
SocketOptionName
.Error && optionValue.Length >= sizeof(int))
1703
public static unsafe SocketError GetMulticastOption(SafeSocketHandle handle,
SocketOptionName
optionName, out MulticastOption? optionValue)
1705
Debug.Assert(optionName ==
SocketOptionName
.AddMembership || optionName ==
SocketOptionName
.DropMembership, $"Unexpected optionName={optionName}");
1707
Interop.Sys.MulticastOption optName = optionName ==
SocketOptionName
.AddMembership ?
1728
public static unsafe SocketError GetIPv6MulticastOption(SafeSocketHandle handle,
SocketOptionName
optionName, out IPv6MulticastOption? optionValue)
1730
Debug.Assert(optionName ==
SocketOptionName
.AddMembership || optionName ==
SocketOptionName
.DropMembership, $"Unexpected optionName={optionName}");
1732
Interop.Sys.MulticastOption optName = optionName ==
SocketOptionName
.AddMembership ?
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\TCPListener.cs (1)
132
Start((int)
SocketOptionName
.MaxConnections);
System\Net\Sockets\UDPClient.cs (9)
262
_clientSocket.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName
.Broadcast, 1);
409
SocketOptionName
.AddMembership,
416
SocketOptionName
.AddMembership,
432
SocketOptionName
.AddMembership,
452
SocketOptionName
.AddMembership,
473
SocketOptionName
.MulticastTimeToLive,
493
SocketOptionName
.DropMembership,
500
SocketOptionName
.DropMembership,
520
SocketOptionName
.DropMembership,