Reputation: 1341
I started a socket-server by
$endpoint = new-object System.Net.IPEndPoint ([system.net.ipaddress]::any, $port)
$listener = new-object System.Net.Sockets.TcpListener $endpoint
Any client with any IP-Address (subject to change) is able to connect.
How do get the IP-Addresse of a connected client after it has connected and was accepted:
if ( $listener.Pending()) {
$client = $listener.AcceptTcpClient()
$stream = $client.GetStream();
$writer = New-Object System.IO.StreamWriter $stream
$writer.AutoFlush = $true
...
}
Unfortunately $client.IPAddress() (error) or $client.IPAddress (nothing) do not exists Thanks in advance!
Upvotes: 0
Views: 1086