Created
January 22, 2014 13:50
-
-
Save jtuttas/8559044 to your computer and use it in GitHub Desktop.
UDP Client / Server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$port=2021 | |
$endpoint = new-object System.Net.IPEndPoint ([IPAddress]"10.13.6.100",$port) | |
$udpclient=new-Object System.Net.Sockets.UdpClient | |
$b=[Text.Encoding]::ASCII.GetBytes('Is anyone there!') | |
$bytesSent=$udpclient.Send($b,$b.length,$endpoint) | |
$udpclient.Close() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$port=2021 | |
$endpoint = new-object System.Net.IPEndPoint ([IPAddress]::Any,$port) | |
$udpclient=new-Object System.Net.Sockets.UdpClient $port | |
$content=$udpclient.Receive([ref]$endpoint) | |
[Text.Encoding]::ASCII.GetString($content) | |
$udpclient.Close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment