TCP Port monitoring in .Net

Hi,

Can anybody point me to articles/links describing best practices for monitoring a specific TCP port I'd like to alert the person running my C# .Net 1.1 windows app that another program is using a specific port (remote monitoring alert).

Thanks for any help in this area.

-Roy



Answer this question

TCP Port monitoring in .Net

  • abinaysh

    Durga has a blog entry that talks about this. See http://blogs.msdn.com/dgorti/archive/2005/09/18/470766.aspx



  • Richard Tong

    Hi Mike,

    Thanks for the concise answer.

    -Roy


  • Brad Carroll

    Hello Durgaprasad,

    Thanks for the information. I was hoping for a bit more detail on how I can monitor the activity of a port that may already have an existing listener bound to it. Is this possible

    I've looked at/compiled the sample code associated with the TCPListener class. This works great when there is no other software using the same port. If another application is running and listening for conection requests on the same port then this seems to fail. The other application I'm referring to is software based on the open source TightVNC (http://www.tightvnc.com). TightVNC is a remote control package. I need to make my software know when someone is using TightVNC to connect on a specific port (on localhost). Is there a way to do this Can you point me to articles/books/blogs that could give me more insight

    Thanks,

    -Roy


  • Mulktide

    I have explained this earlier in a different post.
    Although it is hard to belive, a port can be in use by multiple applications. What matters is
    <Protocol, Source IP, Source Port, Dest IP, Dest Port> combination.
    Meaning that it is perfectly fine to use a local port like 3000 and same local IP address to connect to different servers or same server on different ports for TCP.


  • ArnoByLte

    You cannot monitor the activity of a port that another application has bound to using System.Net. For this you need to investigate Winsock Layered Service Providers (LSP) or the Windows Filtering Platform in Windows Vista.

  • TCP Port monitoring in .Net