- Bind
$Listener = [System.Net.Sockets.TcpListener]443 $Listener.Start() while($true) { $client = $Listener.AcceptTcpClient() Write-Host "Connection received!" $client.Close() }
- Connect
(New-Object Net.Sockets.TcpClient).Connect('192.0.2.1', 443)
$Listener = [System.Net.Sockets.TcpListener]443 $Listener.Start() while($true) { $client = $Listener.AcceptTcpClient() Write-Host "Connection received!" $client.Close() }
(New-Object Net.Sockets.TcpClient).Connect('192.0.2.1', 443)