Hi,
these UDP client and server and simply used for testing if a specific UDP port is open
This is the server side. It listens at port 4444
# Server $iPort = 4444 $Listen = New-Object System.Net.IPEndPoint ([IPAddress]::Any , $port) $oSocket = New-Object System.Net.Sockets.UdpClient($iPort) while($true) { $aContent = $oSocket.Receive([ref]$Listen) [Text.Encoding]::ASCII.GetString($aContent) } $oSocket.Close()
And the client side
# Client $iPort = 4444 $sSendToHost="localhost" $oSocket = New-Object System.Net.Sockets.UdpClient $aMessage=[System.Text.Encoding]::ASCII.GetBytes("TEST 1234") $oSocket.Send($aMessage ,$aMessage.Length,$sSendToHost,$iPort)
Michael