Network - Open Port

Map Of Internet 1973


How to know from a localhost which port are open on a remote host (ie that a firewall is not used or that the process is up and listen)



When the scanner sends a SYN packet to open a TCP connection and gets:

  • the SYN/ACK packet back, the port is considered open.
  • a RST packet is received instead, the port is considered closed.
  • no response, the port is either considered filtered by a firewall or there is no running host at the IP address.


Scanning UDP ports is more difficult because UDP does not use handshakes and programs tend to discard UDP packets that they cannot process. When an UDP packet is sent to a port that has no program bound to it, an ICMP error packet is returned. That port can then be considered closed. When no answer is received, the port can be considered either filtered by a firewall or open. Many people abandoned UDP scanning because simple UDP scanners cannot distinguish between filtered and open ports

List / Test open port


nmap -Pn -p T:port hostName
nc -w1 -z --ssl 443
echo $?


wait for module

- name: Testing that the port is open
      host: hostName
      port: 1433
      state: started
      timeout: 5


Test for open port with powershell:

  • With Test-NetConnection
Test-NetConnection hostname -Port 9999
ComputerName     : hostname
RemoteAddress    :
RemotePort       : 9999
InterfaceAlias   : Wi-Fi
SourceAddress    :
TcpTestSucceeded : True

  • Function with Net.Sockets.TcpClient
function testport {
        [Parameter(Mandatory=$true, HelpMessage='The remote host')]
        [Parameter(Mandatory=$true, HelpMessage='The remote port')]

    $tcpClient = New-Object Net.Sockets.TcpClient
    } catch {
        # Just to not see the exception message

	    "  * Port $remotePort is operational"
	    "  * Port $remotePort is closed"

$remoteHost = "hostname"
$port = 80
"Test Remote Host on $remoteHost"
testport $remoteHost $port

Discover More
Ssl Test Server Www
How to debug / test a TLS / SSL connection ?

This article shows you how to see a SSL connection (handhsake) to debug any problem with configuration for: a server authentication or client authentication Check your firewall. Your port should...
Nmap Open Port Computer
Network - Nmap to (discover|scan) the open port / service

Nmap (“Network Mapper”) is a free and open source (license) utility for network exploration or security auditing that permits to query open port Linux Windows. Download...
Ssh Tunnel Forward Server Network Traffic To Localhost
Ssh - Tunnel - From server to local (Right Port Forwarding)

When the port is not open on a server, you can still reach it via SSH and a right tunnel (or Right port forwarding). When the tunnel is active, a request to a local port will be forwarded via the SSH...
What is a Port in computing?

This article is about the network port, what it is, how we use it and more

Share this page:
Follow us:
Task Runner