WindowsIoctl() public static method

public static WindowsIoctl ( SafeCloseSocket handle, int ioControlCode, byte optionInValue, byte optionOutValue, int &optionLength ) : SocketError
handle SafeCloseSocket
ioControlCode int
optionInValue byte
optionOutValue byte
optionLength int
return SocketError
Example #1
1
        public static SocketError Set(SafeSocketHandle handle, SocketOptionName optionName, int optionValueSeconds)
        {
            IOControlKeepAlive ioControlKeepAlive = s_socketKeepAliveTable.GetOrCreateValue(handle);

            if (optionName == SocketOptionName.TcpKeepAliveTime)
            {
                ioControlKeepAlive._timeMs = SecondsToMilliseconds(optionValueSeconds);
            }
            else
            {
                ioControlKeepAlive._intervalMs = SecondsToMilliseconds(optionValueSeconds);
            }

            byte[] buffer = s_keepAliveValuesBuffer ?? (s_keepAliveValuesBuffer = new byte[3 * sizeof(uint)]);
            ioControlKeepAlive.Fill(buffer);
            int realOptionLength = 0;

            return(SocketPal.WindowsIoctl(handle, unchecked ((int)IOControlCode.KeepAliveValues), buffer, null, out realOptionLength));
        }