1.在Windows下用CMD netstat命令可以获得当前进程监听端口号的信息,如netstat -ano可以看到IP.port.状态和监听的PID. 那么可以执行CMD这个进程得到监听的端口号信息,C#代码如下: //进程id int pid = ProcInfo.ProcessID; //存放进程使用的端口号链表 List<int> ports = new List<int>(); Process pro = new Process(); pro.StartInfo.Fil…
想建立一个测试用的虚拟主机,遇到了这个问题:[root@localhost html]# service httpd startStarting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.termwikidev for ServerName(13)Permission denied: make_sock: could not bind t…
假设忽然起个服务,告诉我8080端口被占用了,OK,我要去看一下是什么服务正在占用着,能不能杀 先假设我是在Windows下: 第一列: Proto 协议 第二列: 本地地址[ip+端口] 第三列:远程地址[] 第四列: 连接状态[一般有ESTABLISHED(建立连接).LISTENING(监听中).TIME_WAIT(等待).CLOSE_WAIT(等待关闭).SYN_SENT()] netstat --h - a 显示所有的链接和接听端口- b 显示执行相关的链接和端口- e 显示和网络相关…