Re: No UDP broadcast messages received
Robert Jordan <[email protected]> Tue, 29 Nov 2011 16:11:35 +0100
| Newsgroups | gmane.comp.gnome.winforms |
|---|---|
| Message-ID | <[email protected]> |
On 29.11.2011 14:40, sharkal wrote: > The socket is configured something like this: > > Socket clientSocket = new Socket(AddressFamily.InterNetwork, > SocketType.Dgram, ProtocolType.Udp); > clientSocket.ReceiveBufferSize = 2 * 1024 * 1024; > clientSocket.Bind(localEndPoint); What IP is localEndpoint? You should rather not bind at all if you want to receive broadcasts. > clientSocket.BeginReceiveFrom(receivebuffer, 0, receivebuffer.Length, > SocketFlags.None, ref localEndPoint, OnReceiveCallback, > clientSocket); > > clientSocket.SetSocketOption(SocketOptionLevel.Socket, > SocketOptionName.Broadcast, 1); > clientSocket.EnableBroadcast = true; The SetSocketOption method is likely called too late, because you're already receiving. Robert _______________________________________________ Mono-winforms-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-winforms-list