如何获得Windows服务打开的端口? [英] How do I get the ports opened by a Windows Service?

查看:91
本文介绍了如何获得Windows服务打开的端口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获取C#中的窗口服务及其端口的列表.我可以使用ServiceController获取所有窗口服务,但无法获取这些服务的端口.

I want to get the list of window services and their ports in C#. I'm able to get all window services by using ServiceController but I'm unable to get ports of these services.

推荐答案

请检查获得> GetExtendedTcpTable,它可以满足您的需要.还要检查这一个.

Please check this question on stackoverlow. It is not exactly the same as you are asking, but it points to a useful function called GetExtendedTcpTable available through PInvoke, that can do what you need. Also check this one.

这篇关于如何获得Windows服务打开的端口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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