Forum Discussion

zhifeng_ke's avatar
zhifeng_ke
Copper Contributor
Mar 30, 2022

Regarding whether windows server has a quick start port listening scheme

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

  • LainRobertson's avatar
    LainRobertson
    Silver Contributor

    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

Resources