[Mono-bugs] [Bug 39178][Nor] Changed - UdpClient.Connect fails with broadcast address
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
Tue, 11 Mar 2003 06:46:30 -0500 (EST)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by dick@ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=39178
--- shadow/39178 Thu Mar 6 11:44:06 2003
+++ shadow/39178.tmp.6634 Tue Mar 11 06:46:30 2003
@@ -67,6 +67,47 @@
Client.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.Broadcast, 1);
before calling Connect.
(Client property = the Socket (it's protected in UdpClient))
+
+------- Additional Comments From dick@ximian.com 2003-03-11 06:46 -------
+Just for reference, I thought I'd added this before but I must have
+forgotten to:
+
+<Dick> EINTR? sounds more like EACCES
+<Dick> System.Net.Sockets.SocketException: Access denied
+<Dick> +in (unmanaged) mono(mono_raise_exception+0x20) [0x80c14f4]
+<Dick> +in (unmanaged) mono
+<Dick> +(ves_icall_System_Net_Sockets_Socket_Connect_internal+0x7a)
+[0x80dbef6]
+<Dick> "EACCES, EPERM
+<Dick> The user tried to connect to a broadcast address
+<Dick> without having the socket broadcast flag enabled or
+<Dick> the connection request failed because of a local
+<Dick> firewall rule.
+<Dick> "
+<gonzalo> i saw a errno=4 with gdb
+<gonzalo> #define EINTR 4 /* Interrupted system
+call */
+<Dick> #define EACCES 13 /* Permission denied */
+<Dick> 321 if(ret==-1) {
+<Dick> (gdb) print errno
+<Dick> $2 = 4
+<Dick> (gdb) n
+<Dick> 322 gint errnum = errno;
+<Dick> (gdb)
+<Dick> 327 errnum = errno_to_WSA (errnum,
+G_GNUC_PRETTY_FUNCTION);
+<Dick> (gdb) s
+<Dick> errno_to_WSA (code=13, function_name=0x8190c73 "_wapi_connect")
+at error.c:62
+<Dick> 62 gint result = -1;
+<Dick> looks like some optimisation has shuffled errno assigning around
+<Dick> there doesnt seem to be any way of setting SO_BROADCAST from
+the class libraries, so i guess we need to see if we get EACCESS and
+try setting it there
+<gonzalo> btw, it works under mono/windows
+<Dick> yeah, its the library or the kernel denying you access for
+broadcast addresses
+