I'm trying to listen for data on port 6267 using a UDP socket.  When I send
data to this socket, nothing happens (udpAudioReciever_DataArrival never
fired).  I've checked the sender and it's using the correct IP address and
port.  Should I be using UdpClient rather than a Socket?  Can anyone tell me
what I've done wrong?

private Socket udpAudioReceiver;


udpAudioReceiver = new Socket (AddressFamily.InterNetwork, SocketType.Dgram,
ProtocolType.Udp);

IPEndPoint ipep = new IPEndPoint (System.Net.IPAddress.Any, 6267);

udpAudioReceiver.Bind (ipep);

udpAudioReceiver.BeginReceive (udpAudioReceiverBuffer, 0,
udpAudioReceiverBuffer.Length, SocketFlags.None, new
AsyncCallback(udpAudioReceiver_DataArrival), udpAudioReceiver);


private void udpAudioReceiver_DataArrival (IAsyncResult asyn)

{

        try {

                int bytesReceived = udpAudioReceiver.EndReceive (asyn);

                // do stuff here
                udpAudioReceiver.BeginReceive (udpAudioReceiverBuffer, 0,
udpAudioReceiverBuffer.Length, SocketFlags.None, new
AsyncCallback(udpAudioReceiver_DataArrival), udpAudioReceiver);

        } catch {

        } 
}


-- 
View this message in context: 
http://mono.1490590.n4.nabble.com/UDP-Socket-callback-not-firing-tp2132638p2132638.html
Sent from the Mono - General mailing list archive at Nabble.com.
_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to