Hi,

On MS.NET it appears that when the UdpClient class is used the socket it
creates has broadcasting enabled. On Mono it is disabled. I have attached a
(totally trivial) patch to UdpClient.cs that resolves this.

Here is a test case that demonstrates the problem (works on MS, fails on
Mono):

[Test]
public void UdpClientBroadcastTest() {
    bool exThrown = false;
    UdpClient client = new UdpClient(new
IPEndPoint(IPAddress.Loopback,1234));
    byte[] bytes = new byte[] {10,11,12,13};
    try {
        client.Send(bytes,bytes.Length,new
IPEndPoint(IPAddress.Broadcast,1235));
    } catch (SocketException) {
        exThrown = true;
    }
    Assert.IsFalse(exThrown,"UdpClient Broadcast #1");
}

Chris

Attachment: UdpClientBroadcast.diff
Description: Binary data

Reply via email to