tcp监听器错误 - 访问套接字 [英] tcp listener error -access a socket

查看:142
本文介绍了tcp监听器错误 - 访问套接字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到以下错误尝试以其访问权限禁止的方式访问套接字



当我执行 tcplistener.start()时。我试图嗅探我的IIS网站。(我的TcpListner和IIS有相同的端口)

I am getting following error "An attempt was made to access a socket in a way forbidden by its access permissions"

when i execute the tcplistener.start(). I am trying to sniff my IIS website.(my TcpListner and IIS having same port)

推荐答案

我没有从上面得到任何运气。



基本上我有一个网站(假设使用端口90),我有一个tcp listner(一个控制台应用程序),它监视来到该端口的请求。

i did not get any luck from above.

basically i have a website (lets say using port 90) and i have a tcp listner (a console application) which is monitoring the request coming to that port.
TcpListener tcplistener = new TcpListener(port);
reportMessage("Listening on port "+ port);
tcplistener.Start();// hit error here.
while (true)
{
//do some thing
}



感谢提前帮助。


thanks for the help in advance.


A 监听器?在与网站相同的机器上?这应该失败,因为尝试在同一个端口上启动两个服务器套接字,但显然有一些神奇的东西使现在不是这样的情况 [ ^ ]。所以我猜你不允许这样做与一个不同进程启动的套接字结合起来。



我也会引导你进入该主题:

A listener? On the same machine as the website? That should fail because of trying to start two server sockets on the same port, but apparently there is some magic that makes that not be the case nowadays[^]. So I would guess that you aren't allowed to do that to combine with a socket started by a different process.

I'd also direct you to the note in that topic:
默认情况下,多个侦听器可以侦听特定端口。但是,只有一个侦听器可以对发送到端口的网络流量执行操作。如果多个侦听器尝试绑定到特定端口,则具有更具体IP地址的侦听器将处理发送到该端口的网络流量。您可以使用ExclusiveAddressUse属性来阻止多个侦听器侦听特定端口。
By default, multiple listeners can listen to a specific port. However, only one of the listeners can perform operations on the network traffic sent to the port. If more than one listener attempts to bind to a particular port, then the one with the more specific IP address handles the network traffic sent to that port. You can use the ExclusiveAddressUse property to prevent multiple listeners from listening to a specific port.



也就是说,您无法监听请求并仍然由原始目标处理它们,无论如何。要做到这一点,你需要挂钩我认为需要P / Invoke调用的网络堆栈。


That is, you can't listen in to requests and still have them processed by the original destination, anyway. To do that you need to hook into the network stack which I believe requires P/Invoke calls.


如果你真的需要嗅探你的网站,你为什么不使用 wireshark [ ^ ]?
If you really just need to sniff your site, why don't you use wireshark[^] ?


这篇关于tcp监听器错误 - 访问套接字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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