0

I am planning on building a program that detects another process tcp/udp connections when they get established. I imagine it contains some sort of loop untill the certain connection has found, and then a secound loop to check if connection is lost.

I check if it was detectable with a program named "TCPView" and found out that the process im after making a connection when I need an event to be called, so thought I should be able to do so with C#.

My question: How do i detect such a thing in C#?

  • All that has been posted is a program description. However, we need you to [ask a question](//stackoverflow.com/help/how-to-ask). We can't be sure what you want from us. Please [edit] your post to include a valid question that we can answer. Reminder: make sure you know [what is on-topic here](//stackoverflow.com/help/on-topic), asking us to write the program for you and suggestions are off-topic. – rene Feb 09 '17 at 11:39
  • @rene added a question :) – Orel Kevin Edry Feb 09 '17 at 11:46
  • possible duplicate: http://stackoverflow.com/questions/570098/in-c-how-to-check-if-a-tcp-port-is-available – rene Feb 09 '17 at 11:50
  • @rene not really, I need to check if a udp socket is used. – Orel Kevin Edry Feb 09 '17 at 12:43
  • So that answer links to System.Net NetworkInformation and the accepted answer suggests to use `IpGlobalProperties` which has an method [`GetActiveUdpListeners`](https://msdn.microsoft.com/en-us/library/system.net.networkinformation.ipglobalproperties.getactiveudplisteners(v=vs.110).aspx). Isn't that close enough? – rene Feb 09 '17 at 12:59

0 Answers0