CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2002
    Location
    Iran
    Posts
    6

    which process listens to which socket?

    hi,

    in fact i've asked this question in vc++ room, but there is no answer yet! i want to write a program that determines which process on my pc listens to which socket, but i have no idea how to write it. can u help me??

    if u are familiar with inzider.exe (ntsecurity.nu) or fport.exe (foundstone.com) these are what i wana write.
    thanx for attention.

  2. #2
    Join Date
    May 2002
    Posts
    20
    This is not a coded way of doing it, infact it's kind of a cop-out. Anyways, if you have access to the computer and it is running windows... A very, very simple way to find out, install and run zonealarm. It'll tell you everything trying to access the internet and which ports they are listening to.
    "People demand freedom of speech to make up for the freedom of thought which
    they avoid".

  3. #3
    Join Date
    May 2002
    Location
    Iran
    Posts
    6
    thanx for attention,


    in fact any firewall or the tiny programs that I named in my question would do it but i want to know how do they know these information about listening ports and processes???

  4. #4
    Join Date
    May 2002
    Posts
    20
    Well, I only have a limited knowledge of how sockets and ports work. So here's pretty much everything i know..heh

    You cannot bind two sockets to the same port. So you can make a for-loop and try to bind a socket to every port. If it fails, you know the port is in use by something else. Next, (there has to be a better way, but i don't know it), you could try to connect to the ports that you have already determined are in use. If the connect fails, then you know it is not a listening socket. If it works, you know it is.

    This is probably the most crude way of doing it, but it will at least tell you which sockets are in use and whether or not they are a listening socket.

    Oh, actually, a second way...once you have tried to bind an have determined which sockets are in use.

    getsockopt() will tell you whether or not the socket is a listening socket.


    Sorry I couldn't be of more help.

    -Avantos
    "People demand freedom of speech to make up for the freedom of thought which
    they avoid".

  5. #5
    Join Date
    May 2002
    Location
    Iran
    Posts
    6
    ok, thanx for attention.
    if i ever solved the problem, i'll tell u!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured