在 C# 中使用 TcpClient.Connect() 进行 WHOIS 查找是否昂贵?

发布于 2024-08-23 02:11:32 字数 376 浏览 14 评论 0原文

客户要求我们根据访问该网站的用户的 IP 在其 ASP.NET 网站的主页上进行动态 whois 查找。

实现类似于此处描述的内容:

http://www.aspheute.com/english/ 20000825.asp

但是,我注意到此代码连接到 whois.networksolutions.com。我认为,如果我们在每次页面加载时都启动与此远程服务器的连接,那么这可能无法很好地扩展。

例如,假设 1000 个不同的用户访问主页 - 这将导致启动大量连接。

对此有什么想法吗?

A customer has asked that we do a dynamic whois lookup on the homepage of their ASP.NET site, based on the IP of the user accessing the site.

The implementation would be something like what's described here:

http://www.aspheute.com/english/20000825.asp

However, I noticed that this code connects to whois.networksolutions.com. I am thinking that this may not scale very well if we are initiating a connection to this remote server on every page load.

For example, say 1000 different users hit the home page - this would cause a lot of connections to be initiated.

Any thoughts on this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

趁微风不噪 2024-08-30 02:11:32

是的,这可能很耗时。 “昂贵”的程度实际上取决于您的服务器和远程服务器之间的网络连接以及远程服务器的响应时间。如果您的请求彼此没有不同(查询最终用户输入的域 who 不太可能出现这种情况),您可以考虑缓存响应。一个更大的问题是,如果远程服务器发现来自单个 IP 地址的连接过多,它可能会阻止您。

Yes, it can be time consuming. The amount of "expensiveness" really depends on the network connection between your server and the remote server and the response time of the remote server. You can consider caching the response if your requests are not different from each other (which is not likely to be the case for querying domain whois entered by end-users). A bigger issue is that the remote server can block you if it sees too many connections from a single IP address.

巡山小妖精 2024-08-30 02:11:32

我可能会询问客户反向 DNS 是否可行...这样您就可以利用 DNS 服务器的缓存功能来减少互联网流量。除非您没有内部 DNS,在这种情况下您将利用 ISP 的 DNS 服务器的缓存功能。

不过,whois 和 DNS 之间存在很大差异,因此由客户决定他们想要什么。

不过,为了回答您直接的问题...也许您可以为此数据创建某种缓存,以减少对浏览网站各个页面的单个主机进行的重复搜索次数?

I might ask the client if reverse DNS is feasible... This way you could leverage the caching abilities of your DNS server to reduce the amount of internet traffic. Unless you don't have internal DNS, in which case you would utilize the caching abilities of your ISP's DNS server.

There is a big difference between whois and DNS though, so it's up to client as to what they want.

To answer you direct question though... Maybe you could create some sort of caching for this data to reduce the number of repeat searches you have to do for a single host surfing various pages of the site?

带上头具痛哭 2024-08-30 02:11:32

除了缓存之外,您可能还希望此查找是异步的,因此任何延迟都不会阻碍页面的服务。

Besides caching, you may also want this lookup to be asynchronous, so any delay does not hold up serving the page.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文