Skip to content

Conversation

@wuqiong
Copy link

@wuqiong wuqiong commented Sep 7, 2021

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
Copy link

Build Fleck 0.0.63-ci completed (commit 403efc3a0b by @wuqiong)

1 similar comment
@AppVeyorBot
Copy link

Build Fleck 0.0.63-ci completed (commit 403efc3a0b by @wuqiong)

@AppVeyorBot
Copy link

Build Fleck 0.0.65-ci completed (commit d1a6a658ea by @wuqiong)

1 similar comment
@AppVeyorBot
Copy link

Build Fleck 0.0.65-ci completed (commit d1a6a658ea by @wuqiong)

@AppVeyorBot
Copy link

Build Fleck 0.0.68-ci completed (commit 4d361dab87 by @wuqiong)

1 similar comment
@AppVeyorBot
Copy link

Build Fleck 0.0.68-ci completed (commit 4d361dab87 by @wuqiong)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants