I'm trying to receive broadcast messages using C# code in an ISDN network with BRI interface at my end.

I see the packets sent to the broadcast ip address ( on some ports using Comm View tool.

But when I try to listen to this IP address, it says the address is not in a valid context.

But when I send broadcast messages to on a port, I can receive those messages with the below code..

What could be the problem with this ip address - ?

The code I use to listen to broadcast messages is..

UdpClient udp = new UdpClient();
IPEndPoint receiveEndPoint = new IPEndPoint(IPAddress.Any, 8013);
// If I use IPAddress.Parse("") to listen to, it says "the address is not in a valid // context."
udp.BeginReceive(_Callback, udp);

static private void _Callback(IAsyncResult iar)
                UdpClient client = (UdpClient)iar.AsyncState;

                client.BeginReceive(_Callback, client);

                IPEndPoint ipRemote = new IPEndPoint(IPAddress.Any, 8013);

                byte[] rgb = client.EndReceive(iar, ref ipRemote);

                Console.WriteLine("Received {0} bytes: \"{1}\"",
                rgb.Length.ToString(), Encoding.UTF8.GetString(rgb));
            catch (ObjectDisposedException)
                Console.WriteLine("closing listening socket");
            catch (Exception exc)
                Console.WriteLine("Listening socket error: \"" +
                exc.Message + "\"");

There are packets sent to the broadcast ipaddress ( which I can see in Commview tool, but can't receive them from the code...

Can anybody help me out please?

Thanking you in advance,
Prasad Kancharla.

Recommended Answers

All 4 Replies

It was my understanding (and I did a little searching that didn't disagree) packets sent to should be available to anyone with a 239.x.x.x address.

Does your computer have a 239.x.x.x address?

Are you listening to the right port?

Hi Murtan,

Thanks for your reply,

My IP address is in a different series -, but I'm connecting to an ISDN network on BRI interface using 1841 router.. their network broadcast ip address is and if somebody in their network sends a broadcast message, it reaches my system on a port 8013 ( I can see it in Commview tool for e.g. I see that there is a broadcast packet sent from an IP 192.168.X.X to on a port 8013 )..

How do I listen to those messages from C#?

Thanks again for your time..


If you're running the commview tool on your same computer, I guess the packets are on your network (though I wouldn't have expected them to be).

Is there any way to associate a 239.x.x.x address with your computer (as well as your current ip address) so that you are 'entitled' to the messages?

If not, I vaguely recall a mode for a connection or card that allowed it to 'see' network packets that were not addressed to it. (If commview is seeing the 239 broadcasts I think that's how it works), but I'm not aware of how to put it in that mode.

I remembered the name 'promiscuous mode' for this type of connection. Looking it up as a definition I find:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.