如何收听RDP套接字3389? [英] How to listen RDP socket 3389?

查看:140
本文介绍了如何收听RDP套接字3389?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在尝试使用Tcplistner类监听端口号3389,如下所示.


Hi everyone,

i am trying to listen port number 3389 using Tcplistner class as follow.


......
......
 static void Main(string[] args)
        {
            // port number 3389 reserved as RDP listener port.
            // 3389 port for listening rdp connection request.
            TcpListener tcpListener = new TcpListener(3389);
            tcpListener.Start(); // here i got exception
            Socket socketForClient = tcpListener.AcceptSocket();
..................
.................




在tcpListener.Start();
我有个例外,说


"Only one usage of each socket address (protocol/network address/port) is normally permitted"

怎么出来的呢?

谢谢大家.




at tcpListener.Start();
i got exception saying


"Only one usage of each socket address (protocol/network address/port) is normally permitted"

how to come out of this?

Thanks all.

推荐答案

如代码中的注释所示:
//端口号3389保留为RDP侦听器端口.
这是标准RDP端口,如果您在计算机上启用了RDP,则RDP服务正在使用此端口.

解决方案是禁用/停止RDP服务或更改默认侦听端口.

如果只想监视新连接,则可以使用
As the comment in your code says:
// port number 3389 reserved as RDP listener port.
this is standard RDP port, and if you have RDP enabled on your computer the RDP service is using this port.

The solution is to disable/stop RDP service or change the default listening port.

If you only want to monitor for new connections you could use GetActiveTcpConnections method:
using System.Net.NetworkInformation;
...
var RdpConnections = IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpConnections().Where(c => c.LocalEndPoint.Port == 3389);



定期调用此按钮以获取新的连接.
遍历RdpConnections并查看其RemoteEndPoint以获取地址.



Call this periodically to get new connections.
Loop through RdpConnections and look at their RemoteEndPoint for address.


这篇关于如何收听RDP套接字3389?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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