Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ SupportsKeepAliveViaSocketOption()

static bool System.Net.Sockets.IOControlKeepAlive.SupportsKeepAliveViaSocketOption ( )
inlinestaticprivate

Definition at line 73 of file IOControlKeepAlive.cs.

74 {
75 AddressFamily addressFamily = (Socket.OSSupportsIPv4 ? AddressFamily.InterNetwork : AddressFamily.InterNetworkV6);
76 using Socket socket = new Socket(addressFamily, SocketType.Stream, ProtocolType.Tcp);
77 int optionValue = MillisecondsToSeconds(7200000u);
78 SocketError socketError = global::Interop.Winsock.setsockopt(socket.SafeHandle, SocketOptionLevel.Tcp, SocketOptionName.TypeOfService, ref optionValue, 4);
79 int optionValue2 = MillisecondsToSeconds(1000u);
80 SocketError socketError2 = global::Interop.Winsock.setsockopt(socket.SafeHandle, SocketOptionLevel.Tcp, SocketOptionName.BlockSource, ref optionValue2, 4);
81 return socketError == SocketError.Success && socketError2 == SocketError.Success;
82 }
static int MillisecondsToSeconds(uint milliseconds)

References System.Net.Sockets.IOControlKeepAlive.MillisecondsToSeconds(), and System.Net.Sockets.Socket.