如何捕获每个Windows的传出/传入网络连接!? [英] How to catch every windows' outgoing/incoming network connection!?

查看:70
本文介绍了如何捕获每个Windows的传出/传入网络连接!?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我需要编写一个应用程序来捕获每个传出/传入的网络连接!

我完全不知道如何在主机和网络区域之间转换的窍门!


是否有需要监听的特定IP/端口或网络conf文件中的任何配置!
任何帮助将不胜感激,我只需要一个线索!

hey guys

i need to write a application to catch every outgoing/incoming network connection!

i totally don''t know the trick that how to become between host and network area!

is there any specific IP/Port that needs to be listened or any configuration in network conf file or any thing!?

Any help would be appreciate, i just need a clue!

thanks in advance.

推荐答案

如果您只想监视连接,请尝试:

If you only want to monitor connections try:

using System.Net.NetworkInformation;
...
var connections = IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpConnections();



您需要定期调用它以捕获新的连接.

您还可以使用WinPCap捕获所有网络数据包并从中提取源IP地址和目标IP地址和端口.

如果要控制这些连接,则应使用Win2000以后可用的数据包筛选API".这里有几篇文章可以用来开始:
.NET中的数据包过滤
简单数据包-过滤防火墙
为Windows 2000/XP开发防火墙



You''ll need to call this periodically to catch new connections.

You could also use WinPCap to capture all network packets and extract source and destination IPs and ports from them.

If you want to control those connections you should use ''Packet Filtering API'' available since Win2000. There are few articles here you can use to start:
Packet Filtering in .NET
Simple Packet - Filter Firewall
Developing Firewalls for Windows 2000/XP


您好,

请看看我的解决方案,也许它也对您有用.它不是捕获数据包之类的东西,而是一种证明连接是否建立的方法.

已建立Internet连接的监听器 [
Hi,

Please have a look at my solution, maybe it also works for you. It''s not catching packets or something, it''s a method to proof if connection is established.

Listener on internet connection established[^]

With Best Regards


这篇关于如何捕获每个Windows的传出/传入网络连接!?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆