简体   繁体   English

获取C#局域网中端口上所有侦听服务器的列表

[英]Get a List of all listening servers on a port on the LAN in C#

Suppose I want to check see which hosts are listening for a connection on a specific port on the local area network, How would this be accomplished in C#. 假设我要检查哪些主机正在侦听局域网中特定端口上的连接,这将如何在C#中完成。 The reason i want this is so that I can connect to a server thats listening on the LAN by specifying the host name. 我想要这样做的原因是,我可以通过指定主机名连接到在LAN上侦听的服务器。

You mean a portscan, but one where it scans a subnet for 1 single port? 您的意思是一个端口扫描,但是它可以扫描一个子网的单个端口? Ok, what you need is System.Net.Sockets.TcpClient and 64 or so System.Threading.Thread s. 好的,您需要的是System.Net.Sockets.TcpClient和64个左右的System.Threading.Thread

possible only with connection orianted protocols like TCP. 仅适用于连接规范的协议(例如TCP)。

why not just iterate the computers in the network trying taking a socket and trying to connect to the port you are probing? 为什么不只是尝试尝试插入套接字并尝试连接到要探测的端口来迭代网络中的计算机?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM