all groups > dotnet remoting > march 2007 >
You're in the

dotnet remoting

group:

UDPClient Broadcast Receive Error with PPPOE


Re: UDPClient Broadcast Receive Error with PPPOE Peter Duniho
3/24/2007 9:55:53 AM
dotnet remoting:
On Sat, 24 Mar 2007 05:50:01 -0700, greenxiar <greenxiar@hotmail.com>
[quoted text, click to view]

Broadcast datagrams are not routable over the Internet (and for good
reason, if you think about it).

You'll need to use multicast or send the datagram directly to a given IP
Re: UDPClient Broadcast Receive Error with PPPOE Peter Duniho
3/24/2007 1:02:05 PM
On Sat, 24 Mar 2007 12:36:16 -0700, greenxiar <greenxiar@hotmail.com>
[quoted text, click to view]

Sorry...I misunderstood and thought you were trying to send over the PPPOE
connection.

Just to make sure I have things straight: you have a UDP client receiving
UDP broadcast datagrams; it works fine when you are not connected to the
Internet, but when you make a connection to the Internet using PPPOE, it
stops receiving the broadcast datagrams.

If so, I suspect it is still related to the fact that datagrams can't be
routed over the Internet. It sounds as though the network adapter on the
computer, once PPPOE is connected, treats all communications as though
they are over the Internet. Why this should be exactly I can't say for
sure, not being that familiar with PPPOE. Maybe someone else has a better
answer.

You may get some insight by using ipconfig to display the network
configuration for your network adapter, to see what happens to the local
IP address and routing/gateway information. That may help you see what
changes that causes the broadcasts to be blocked. Whether that would lead
to a solution, I don't know...if you are running into a fundamental change
in the network configuration that blocks the datagrams, you may be stuck
with the same limitations that exist over the Internet proper.

UDPClient Broadcast Receive Error with PPPOE greenxiar
3/24/2007 8:50:01 PM
My Computer is Win2K3 R2, Code is:

using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;

namespace TechUDPBroadcast {
class Program {
static void Main(string[] args) {
const string addr = "224.1.3.99";
const int prt = 12799;

UdpClient udpc = new UdpClient();
udpc.Client.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.ReuseAddress,
true);
udpc.Client.Bind(new IPEndPoint(IPAddress.Any, prt));
udpc.EnableBroadcast = true;

udpc.JoinMulticastGroup(IPAddress.Parse(addr));

ManualResetEvent abort = new ManualResetEvent(false);
WaitHandle[] evs = new WaitHandle[2];
evs[0] = abort;
ThreadPool.QueueUserWorkItem(new WaitCallback(delegate {
while (true) {
IAsyncResult asy = udpc.BeginReceive(
new AsyncCallback(delegate(IAsyncResult
iasy) {
IPEndPoint rp = null;
byte[] recv = udpc.EndReceive(iasy, ref rp);
Console.Write(".");
}), null);
evs[1] = asy.AsyncWaitHandle;
if (WaitHandle.WaitAny(evs) == 0) return;
}
}));
ThreadPool.QueueUserWorkItem(new WaitCallback(delegate {
for (int i = 0; i < 1000; i++) {
udpc.Send(new byte[] { 0x1, 0x2 }, 2,
new IPEndPoint(IPAddress.Parse(addr),
prt));
Console.Write("+");
Thread.Sleep(1000);
if (abort.WaitOne(0, false)) return;
}
}));
Console.ReadKey();
Abort.Set();
}
}
}
When my computer is single network connection(Local Network),
the code works fine. My problem is, when i connect the Internet with PPPOE,
the UDPClient can not receive the broadcasting data!

Why?

greenxiar

Re: UDPClient Broadcast Receive Error with PPPOE greenxiar
3/25/2007 12:00:00 AM
When the app is running at local network(Internet not connected),
the sending and receiving are good.
Then i launch the internet connection, the app stop receiving immediately.
The data packages are sent to both Local and Internet
(In Netmon.exe i can see it). Why UdpClient stop receiving?
What happened when i connect the internet?

"Peter Duniho" <NpOeStPeAdM@nnowslpianmk.com> дÈëÏûÏ¢
news:op.tppdbfiz8jd0ej@petes-computer.local...
[quoted text, click to view]

AddThis Social Bookmark Button