监听特定端口c#
我想在c#中监听特定端口,但我不想在net中编写聊天程序。 我只想监听一个端口并接收来自该端口的所有字节。 我之前问过这个问题,但没有得到有用的答案。我再说一遍,我不想有客户端和服务器程序,我只想有一个在我的计算机上运行并显示从特定端口接收到的字节的程序,或者一个显示 IP 是什么的程序连接到每个端口,就像 CMD 中的“netstat”命令。(我不想在我的 C# 程序中使用 CMD 命令) 请帮我。
I want to listen specific port in c#, but I don't want to write a chat program in net.
I just want listen to a port and receive all of the bytes that come from that port.
I asked this question before but I did't get a useful answer. I say again, I don't want to have a client and server program, I want to just have a single program that run on my Computer and show me what bytes are received from specific port, or a program that show me what IP is connected to each port , like "netstat" command in CMD.(I don't want to use CMD command in my C# program)
please help me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为这应该让你开始。这将向您显示与
netstat
类似的信息:要监听端口,请使用 Microsoft 这里 应该可以帮助您。
I think this should get you started. This will show you similar information to
netstat
:To listen to a port, the sample code provided by Microsoft here should get you going.
你需要一个嗅探器。检查Wireshark。
You need a sniffer. Check Wireshark out.