当前位置: 首页 > news >正文

如何在Windows XP以上的版本中得知一个进程所使用的端口


原文出处:http://www.winntmag.com/Article/ArticleID/39955/39955.html

How can I determine which ports a specific process is using on Windows XP and later?

A. If you want to find out which ports a process is using and you know the process name, you must first determine the process identifier (PID). For example, to identify the PID for the pop3svc.exe process running on my system, I went to the command prompt and typed

c:\> tasklist /fi "IMAGENAME eq pop3svc.exe"
This command returned the following information:

Image Name PID Session Name Session# Mem Usage
POP3Svc.exe 3044 RDP-Tcp#9 0 2,072 K
The second column shows the PID, which I can then use with the Netstat command to search all in-use ports. For example, if I type

c:\> netstat -ano | findstr 3044
my system returns the following information:

TCP 0.0.0.0:110 0.0.0.0:0 LISTENING 3044
This result shows that the POP3 service was using TCP port 110 on all addresses.

You can also perform a reverse operation to find out which process is associated with a port. For example, to identify which process is using port 25, I could go to the command prompt and type

c:\> netstat -ano | findstr :25
On my system, this command returns the following information:

TCP 0.0.0.0:25 0.0.0.0:0 LISTENING 2500
After I identify the process (in this case, 2500), I can determine the process name by typing

c:\> tasklist /fi "PID eq 2500"
which returns the following information on my system:

Image Name PID Session Name Session# Mem Usage
inetinfo.exe 2500 RDP-Tcp#9 0 5,584 K
This information tells me that port 25 is being used by the inetinfo.exe process.

You can also use the TCPView program from http://www.sysinternals.com, which makes the whole process a lot simpler.

如何在Windows XP以上的版本中得知一个进程所使用的端口?

如果你想知道一个进程正在使用着哪个端口并且你知道此进程的名字,首先必须确定此进程的进程标识符(PID)。例如,标识运行在系统中的pop3svc.exe的PID,输入以下命令:

c:\> tasklist /fi "IMAGENAME eq pop3svc.exe"
此命令返回以下信息:

Image Name PID Session Name Session# Mem Usage
POP3Svc.exe 3044 RDP-Tcp#9 0 2,072 K

其中第二列显示了进程的PID,则我可以使用Netstat命令来搜索所有使用中的端口。如下所示:

c:\> netstat -ano | findstr 3044
系统返回以下信息:

TCP 0.0.0.0:110 0.0.0.0:0 LISTENING 3044
此结果显示了POP3服务正在所有地址上使用TCP端口110监听。

也可以使用反向的操作来找出哪一个进程给分配到一个指定的端口,例如,为了找出哪一个进程正在使用端口25,可以使用以下命令:

c:\> netstat -ano | findstr :25
系统返回了以下信息:

Image Name PID Session Name Session# Mem Usage
inetinfo.exe 2500 RDP-Tcp#9 0 5,584 K

此信息告诉我们端口25正在被inetinfo.exe进程使用着。

当然你也可以使用第三方提供的TCPView程序来完成此功能,更多有关TCPView的信息请访问
http://www.sysinternals.com

相关文章:

  • 装饰器@property的介绍与使用
  • 我们还只做了一半
  • pandas的groupby函数
  • 手机丢了
  • scrapy框架——下载器中间件(Downloader Middlewares)
  • 如何使用scrapy下载图片
  • 关于windows上的lsass.exe进程
  • 如何匹配Python库的版本?
  • 如何将 Windows 2000 安装移到不同的硬件
  • 如何安装Redis?
  • 华中之旅--逃离广州(二)
  • 人人网如何注册与设置密码
  • 华中之旅-- 瑞雪岳阳城
  • 谈一下分布式爬虫
  • redis-desktop-manager安装
  • php的引用
  • [PHP内核探索]PHP中的哈希表
  • 77. Combinations
  • angular组件开发
  • Cookie 在前端中的实践
  • JavaScript 无符号位移运算符 三个大于号 的使用方法
  • js递归,无限分级树形折叠菜单
  • Just for fun——迅速写完快速排序
  • Kibana配置logstash,报表一体化
  • leetcode讲解--894. All Possible Full Binary Trees
  • nodejs:开发并发布一个nodejs包
  • python 学习笔记 - Queue Pipes,进程间通讯
  • react 代码优化(一) ——事件处理
  • Theano - 导数
  • vue:响应原理
  • windows下使用nginx调试简介
  • 初探 Vue 生命周期和钩子函数
  • 如何用vue打造一个移动端音乐播放器
  • 使用Swoole加速Laravel(正式环境中)
  • 思考 CSS 架构
  • 学习ES6 变量的解构赋值
  • 学习笔记DL002:AI、机器学习、表示学习、深度学习,第一次大衰退
  • ​【C语言】长篇详解,字符系列篇3-----strstr,strtok,strerror字符串函数的使用【图文详解​】
  • ​HTTP与HTTPS:网络通信的安全卫士
  • ​TypeScript都不会用,也敢说会前端?
  • #{}和${}的区别是什么 -- java面试
  • #传输# #传输数据判断#
  • (01)ORB-SLAM2源码无死角解析-(56) 闭环线程→计算Sim3:理论推导(1)求解s,t
  • (17)Hive ——MR任务的map与reduce个数由什么决定?
  • (aiohttp-asyncio-FFmpeg-Docker-SRS)实现异步摄像头转码服务器
  • (pytorch进阶之路)CLIP模型 实现图像多模态检索任务
  • (超详细)2-YOLOV5改进-添加SimAM注意力机制
  • (五)大数据实战——使用模板虚拟机实现hadoop集群虚拟机克隆及网络相关配置
  • (一)Neo4j下载安装以及初次使用
  • (一)插入排序
  • (已解决)报错:Could not load the Qt platform plugin “xcb“
  • (转载)虚函数剖析
  • .jks文件(JAVA KeyStore)
  • .NET MVC第三章、三种传值方式
  • .NET NPOI导出Excel详解