Re: socket in LISTENING state after a call to closesocket
- From: "Ben Voigt [C++ MVP]" <rbv@xxxxxxxxxxxxx>
- Date: Thu, 9 Apr 2009 17:27:51 -0500
My question was why the socket was still in LISTENING mode after IThe socket is release when I kill the subprocess. I have used
calc.exe as subprocess with the same behavior.
What was your question? It sounds as if subprocesses are being
created with the "inherit handles" capability enabled. Until the
subprocess closes its handle, the socket isn't really closed. Or
something like that.
called closesocket but your answer raised another question. "inherit
handles" capability, how does it work and how do I turn it off on a
process started from managed code.
You can't, because it's not an attribute of the process. It's controlled at
the time the child process is launched.
In Windows, all methods of starting a process eventually call CreateProcess
http://msdn.microsoft.com/en-us/library/ms682425(loband).aspx
Apparently Process.Start or whatever you are using to start a child task is
passing TRUE as the value of bInheritHandles. And if the framework is
starting a child task somewhere, somehow, and allowing it to inherit
handles.... then you're pretty much at its mercy. But I would be surprised
to find out that the framework is doing something so stupid. More likely
it's a global Windows hook or other injected DLL (things like multi-monitor
management programs often install these) that is making unauthorized
duplicates of your handle.
.
- Follow-Ups:
- Re: socket in LISTENING state after a call to closesocket
- From: boris
- Re: socket in LISTENING state after a call to closesocket
- From: Günter Prossliner
- Re: socket in LISTENING state after a call to closesocket
- References:
- socket in LISTENING state after a call to closesocket
- From: vojat
- Re: socket in LISTENING state after a call to closesocket
- From: Ben Voigt [C++ MVP]
- Re: socket in LISTENING state after a call to closesocket
- From: vojat
- socket in LISTENING state after a call to closesocket
- Prev by Date: RE: WSASend/WSARecv and IOCP GetQueuedCompletionStatus
- Next by Date: Re: setting socket option by setsockopt() have no effect
- Previous by thread: Re: socket in LISTENING state after a call to closesocket
- Next by thread: Re: socket in LISTENING state after a call to closesocket
- Index(es):
Relevant Pages
|