[Winpcap-users] how to find active ports
Gisle Vanem
gvanem at broadpark.no
Fri Jul 1 06:11:07 PDT 2011
"rajath kumara" <rajathkumara at gmail.com> wrote:
> Currently I am using wpcap function to obtain list of all ports in my
> system.
I thought you were talking about TCP/UDP-ports until ...
> but assume i need to find only active ports in my system, for this, is
> their any wpcap function which will provide me
> list of all active ports in my system?
>
> for eg: i have some 10 ports in my system.
> if i use a cross cable and create a loopback among 2 ports, then,
.. I read the above. You have a box with 10 network interfaces?
> is their any wpcap function, which gives me list of only
> loopback active ports?
In any case, there isn't any WinPcap function that does this; neither finds
active/listening UDP/TCP-ports nor makes a "list of all active physical ports".
You have to specify your problem a bit more.
If you want to find active/listening ports, then (depending on your OS) there
are functions deep inside the OS for retrieving that information (like netstat
does). In case you use Windows, the functions AllocateAndGetTcpExTableFromStack()
and GetExtendedTcpTable() does that.
--gv
More information about the Winpcap-users
mailing list