statianzo / Fleck

C# Websocket Implementation
MIT License
2.31k stars 585 forks source link

expose listen Socket property in Interface ISocket. #316

Open wuqiong opened 3 years ago

wuqiong commented 3 years ago

some times, need to get the underlying listen socket for other purpose. as I need to prevent inherit the listen socket when creating subprocess.

[DllImport("kernel32.dll", SetLastError = true)]
static extern bool SetHandleInformation(IntPtr hObject, uint dwMask, uint dwFlags);
private const uint HANDLE_FLAG_INHERIT = 1;
// ...
private static void MakeNotInheritable(Socket tcpListenedSocket)
{
    var handle = tcpListenedSocket.Handle;
    SetHandleInformation(handle, HANDLE_FLAG_INHERIT, 0);
}
AppVeyorBot commented 3 years ago

:white_check_mark: Build Fleck 0.0.63-ci completed (commit https://github.com/statianzo/Fleck/commit/403efc3a0b by @wuqiong)

AppVeyorBot commented 3 years ago

:white_check_mark: Build Fleck 0.0.63-ci completed (commit https://github.com/statianzo/Fleck/commit/403efc3a0b by @wuqiong)

AppVeyorBot commented 3 years ago

:white_check_mark: Build Fleck 0.0.65-ci completed (commit https://github.com/statianzo/Fleck/commit/d1a6a658ea by @wuqiong)

AppVeyorBot commented 3 years ago

:white_check_mark: Build Fleck 0.0.65-ci completed (commit https://github.com/statianzo/Fleck/commit/d1a6a658ea by @wuqiong)

AppVeyorBot commented 2 years ago

:white_check_mark: Build Fleck 0.0.68-ci completed (commit https://github.com/statianzo/Fleck/commit/4d361dab87 by @wuqiong)

AppVeyorBot commented 2 years ago

:white_check_mark: Build Fleck 0.0.68-ci completed (commit https://github.com/statianzo/Fleck/commit/4d361dab87 by @wuqiong)