如何读取网络连接 [英] How to read network connections

查看:87
本文介绍了如何读取网络连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个阻止自定义网址列表的应用程序,例如打开和展示广告的窗口。我希望看到正在使用哪些互联网连接,这是我完成应用程序所需的全部内容。我希望这可以在所有浏览器上工作,但这不是100%的需要。



有谁可以帮助我开始?我搜索了一下,找到了我想要的东西。但我希望这可以搜索所有连接,而不仅仅是浏览器当前网址。我想在vb.net中编写这段代码我知道我可以使用计时器继续检查网络连接,但我需要什么代码?

I would like to create an application that will block a custom list of urls for example those windows that open and display ads. I would like it to see which internet connections are being used that is all I would need to finish the application. I would like this to work on all browsers how ever that is not 100% needed.

Could anyone help me get started? I have googled around and found things close to what I would like. But I would like this to search all connections not just the browsers current url if possible. I would like to write this code in vb.net I understand I could use a timer to continue checking network connections, but what code would I need?

推荐答案

你' d写一个代理服务器。然后,代理可以过滤掉URL,而不必知道任何关于正在使用的浏览器的任何内容,也不了解任何关于任何开放连接的内容。浏览器必须通过你的代理服务器从互联网上获取内容。





走开放连接路线很漂亮愚蠢,因为在HTTP请求期间,连接打开,请求传输,然后响应接收和连接关闭。对于大多数请求,这种情况发生得非常快,而且您无法通过开放连接做任何事情,因为它已经太晚了。
You'd be writing a proxy server. The proxy can then filter out URL's without having to know anything at all about the browsers being used nor anything at all about any "open connections". The browsers would have to go through your proxy server to get content from the Internet.


Going the "open connections" route is pretty stupid because during a HTTP request, the connection is opened, request transmitted, and then response received and connection closed. For most requests, this happened pretty quick and you're not going to be able to do anything at all with the "open connection" because it's already too late.


这篇关于如何读取网络连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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