following code I use on ND+ to receive UDP Broadcast packets
from iPhone and it works fine here with 4.1 and 4.2:
private void threadStartTarget() { _socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); try { IPEndPoint broadcastEndPoint = new IPEndPoint( System.Net.IPAddress.Any, LocalPort); _socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true); if (Broadcast) _socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true); _socket.Bind(broadcastEndPoint); while (true) { EndPoint remoteEndPoint = new IPEndPoint( System.Net.IPAddress.Any, 0); int availableBytes = _socket.Available; if (availableBytes > 0) { byte[] receiveBuffer = new byte[availableBytes]; _socket.ReceiveFrom(receiveBuffer, ref remoteEndPoint); if (DataReceived != null) DataReceived(this, new DataReceivedEventArgs( receiveBuffer, remoteEndPoint)); } // This is recommends in thread loops to help prevent lock-ups Thread.Sleep(10); } } catch (Exception e) { // catch all exceptions Debug.Print(e.ToString()); } finally { doDispose(); if (SocketDone != null) SocketDone(this, EventArgs.Empty); Debug.Print("UDP server thread finished."); } }HTH, Immo