Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose listen Socket property in Interface ISocket. #316

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

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.

None yet

2 participants