Regarding whether windows server has a quick start port listening scheme

Copper Contributor

Linux servers all have a certain version of Python installed by default, and Python can provide a simple service, it is very easy, You can quickly create a port listener for testing network connectivity

Python2:python -m SimpleHTTPServer 8080

Python3:python -m http.server 8080

May I ask if there is a similar operation on windows server

thx

3 Replies

@zhifeng_ke You can use the Httplistener module, install-module Httplistener and then run Start-HTTPListener -Port 8080 . Perhaps you will need to allow the port in the Windows Firewall first depending on your environment.

 

For more information : https://devblogs.microsoft.com/powershell/simple-http-api-for-executing-powershell-scripts/

@zhifeng_ke 

 

Yeah, you can. It's not a command like what you've used in your example but it's perfectly fine for network connectivity testing.

 

Here's an example using TCP 41000.

 

Start listening command:

 

($listener = [System.Net.Sockets.TcpListener]::new([System.Net.IPAddress]::Any, 41000)).Start()

 

 

Running a basic test command from on the host itself against the listener from above:

 

Test-NetConnection -ComputerName localhost -Port 41000

 

 

Finally, stop the listener:

 

$listener.Stop()

 

 

Cheers,

Lain

Did it work out for you using the httplistener module?