Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
This is a sniffer, not easy to implement, try the WinPCap driver (used in Wireshark), or the Fiddler library, it acts like a proxy and is easier to deal with, but it is only for HTTP and HTTPS.
winpcap and some pcap dot net , watch all traffic and filter connections.
static void ListAvailableTCPPort(ref ArrayList usedPort)
{
IPGlobalProperties ipGlobalProperties = IPGlobalProperties.GetIPGlobalProperties();
TcpConnectionInformation[] tcpConnInfoArray = ipGlobalProperties.GetActiveTcpConnections();
IEnumerator myEnum = tcpConnInfoArray.GetEnumerator();
while (myEnum.MoveNext())
{
TcpConnectionInformation TCPInfo = (TcpConnectionInformation)myEnum.Current;
Console.WriteLine("Port {0} {1} {2} ", TCPInfo.LocalEndPoint, TCPInfo.RemoteEndPoint, TCPInfo.State);
usedPort.Add(TCPInfo.LocalEndPoint.Port);
}
}
public static void Main()
{
ArrayList usedPorts = new ArrayList();
ListAvailableTCPPort(ref usedPorts);
Console.ReadKey();
}
How can I filter the required connection from this list?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question