Re: Mapping local ports to connected sockets
- From: "Volodymyr M. Shcherbyna" <v_scherbina@xxxxxxxxxxxxxxx>
- Date: Mon, 3 Mar 2008 23:35:30 +0100
You can get this info at TDI layer, but this require a lot of efforts.
--
V.
This posting is provided "AS IS" with no warranties, and confers no
rights.
"Mark" <Mark@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:CD768D68-7DE4-44C7-8B2C-CFE07A0865DA@xxxxxxxxxxxxxxxx
Hello,
I am adding a monitor thread to my process. The idea is to identify
which socket (as in the SOCKET identifier) is making the connetion
using which (local) port. I am doing it in a thread because
I cannot modify the original program.
I tried enumerating all sockets and do getsockname on them,
but no luck, because some of those are non-blocking connects,
so even though connect() has returned, getsockname returns error.
I'd like to be able to get that information as soon as possible,
basically once the connection has been established (I can tell
that alot of times, getsockname() fails long after the
connection has been accepted by the other side).
So I am thinking about doing it in reverse: enumerating all
connected ports and see if I can how the corresponding socket,
the question is, is that doable and how do I do that.
Thanks alot, any idea at all will help.
.
- Prev by Date: Re: Kernel mode socket
- Next by Date: Re: Kernel mode socket
- Previous by thread: Re: Kernel mode socket
- Next by thread: EnumProtocols() does not work on Windows Vista and Windows
- Index(es):
Relevant Pages
|