Broadcasting UDP messages across local network - Stack Overflow

admin2025-04-15  3

Until a couple of days ago I had some software that was broadcasting udp messages to a port, which a different machine on the local network was receiving.

It seems like that process has stopped working but not sure why.

As a test script, running the below scripts:

\\ sender.ps1
$udpClient = New-Object System.Net.Sockets.UdpClient
$endpoint = New-Object System.Net.IPEndPoint ([System.Net.IPAddress]::Broadcast, 20777)
$data = [System.Text.Encoding]::ASCII.GetBytes("Test Message Here")
$udpClient.Send($data, $data.Length, $endpoint)
\\ receiver.ps1
$udpClient = New-Object System.Net.Sockets.UdpClient 20777
$endpoint = New-Object System.Net.IPEndPoint ([System.Net.IPAddress]::Any, 0)
while ($true) {
    $data = $udpClient.Receive([ref]$endpoint)
    Write-Output ("Received: " + [System.Text.Encoding]::ASCII.GetString($data))
}

When running on the same machine, the message is received, however when running on the sender, and one on the receiver, the receiver doesn't output anything.

NB These scripts have only been written for debugging my issue, so I can't say categorically that they would have worked before my issue started happening

I've tried disabling my firewall, but alas nothing seems to be coming through. Using arp -a on both machines, I can see the other corresponding machine.

What steps can I take to understand where the packets are going?

Thanks

Until a couple of days ago I had some software that was broadcasting udp messages to a port, which a different machine on the local network was receiving.

It seems like that process has stopped working but not sure why.

As a test script, running the below scripts:

\\ sender.ps1
$udpClient = New-Object System.Net.Sockets.UdpClient
$endpoint = New-Object System.Net.IPEndPoint ([System.Net.IPAddress]::Broadcast, 20777)
$data = [System.Text.Encoding]::ASCII.GetBytes("Test Message Here")
$udpClient.Send($data, $data.Length, $endpoint)
\\ receiver.ps1
$udpClient = New-Object System.Net.Sockets.UdpClient 20777
$endpoint = New-Object System.Net.IPEndPoint ([System.Net.IPAddress]::Any, 0)
while ($true) {
    $data = $udpClient.Receive([ref]$endpoint)
    Write-Output ("Received: " + [System.Text.Encoding]::ASCII.GetString($data))
}

When running on the same machine, the message is received, however when running on the sender, and one on the receiver, the receiver doesn't output anything.

NB These scripts have only been written for debugging my issue, so I can't say categorically that they would have worked before my issue started happening

I've tried disabling my firewall, but alas nothing seems to be coming through. Using arp -a on both machines, I can see the other corresponding machine.

What steps can I take to understand where the packets are going?

Thanks

Share Improve this question asked Feb 4 at 11:30 Richard WhitehouseRichard Whitehouse 6913 gold badges14 silver badges28 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

NordVPN seems to be the issue so must have it's own firewall built in that's recently started blocking the messages.

转载请注明原文地址:http://www.anycun.com/QandA/1744723316a86731.html