зеркало из https://github.com/mono/mail-archives.git
116 строки
3.5 KiB
HTML
116 строки
3.5 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE> [Mono-list] UdpClient broadcast bug?
|
|
</TITLE>
|
|
<LINK REL="Index" HREF="index.html" >
|
|
<LINK REL="made" HREF="mailto:chris.bacon%40docobo.co.uk">
|
|
<META NAME="robots" CONTENT="index,nofollow">
|
|
|
|
<LINK REL="Previous" HREF="025956.html">
|
|
<LINK REL="Next" HREF="025968.html">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#ffffff">
|
|
<H1>[Mono-list] UdpClient broadcast bug?
|
|
</H1>
|
|
<B>Chris Bacon
|
|
</B>
|
|
<A HREF="mailto:chris.bacon%40docobo.co.uk"
|
|
TITLE="[Mono-list] UdpClient broadcast bug?">chris.bacon@docobo.co.uk
|
|
</A><BR>
|
|
<I>Wed, 23 Feb 2005 11:56:42 -0000</I>
|
|
<P><UL>
|
|
<LI> Previous message: <A HREF="025956.html">[Mono-list] CertificatePoliciesExtension
|
|
</A></li>
|
|
<LI> Next message: <A HREF="025968.html">[Mono-list] UdpClient broadcast bug?
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#25958">[ date ]</a>
|
|
<a href="thread.html#25958">[ thread ]</a>
|
|
<a href="subject.html#25958">[ subject ]</a>
|
|
<a href="author.html#25958">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
<HR>
|
|
<!--beginarticle-->
|
|
<PRE>This is a multi-part message in MIME format.
|
|
|
|
|
|
------=_NextPart_000_0715_01C5199E.BD9BAAF0
|
|
Content-Type: text/plain;
|
|
charset="iso-8859-1"
|
|
Content-Transfer-Encoding: 7bit
|
|
|
|
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
|
|
|
|
------=_NextPart_000_0715_01C5199E.BD9BAAF0
|
|
Content-Type: application/octet-stream;
|
|
name="UdpClientBroadcast.diff"
|
|
Content-Transfer-Encoding: quoted-printable
|
|
Content-Disposition: attachment;
|
|
filename="UdpClientBroadcast.diff"
|
|
|
|
Index: UdpClient.cs=0A=
|
|
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
|
|
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
|
|
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
|
|
--- UdpClient.cs (revision 41083)=0A=
|
|
+++ UdpClient.cs (working copy)=0A=
|
|
@@ -119,7 +119,9 @@=0A=
|
|
socket =3D new Socket (family, SocketType.Dgram, ProtocolType.Udp);
|
|
=20
|
|
if (localEP !=3D null)
|
|
- socket.Bind (localEP);
|
|
+ socket.Bind (localEP);=0A=
|
|
+ =0A=
|
|
+ =0D socket.SetSocketOption(SocketOptionLevel.Socket, =
|
|
SocketOptionName.Broadcast, true);
|
|
}
|
|
=20
|
|
#endregion // Constructors
|
|
|
|
------=_NextPart_000_0715_01C5199E.BD9BAAF0--
|
|
|
|
|
|
</PRE>
|
|
<!--endarticle-->
|
|
<HR>
|
|
<P><UL>
|
|
<!--threads-->
|
|
<LI> Previous message: <A HREF="025956.html">[Mono-list] CertificatePoliciesExtension
|
|
</A></li>
|
|
<LI> Next message: <A HREF="025968.html">[Mono-list] UdpClient broadcast bug?
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#25958">[ date ]</a>
|
|
<a href="thread.html#25958">[ thread ]</a>
|
|
<a href="subject.html#25958">[ subject ]</a>
|
|
<a href="author.html#25958">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
</body></html>
|