[Mono-list] UDP Socket not firing
Steve Ricketts
velocedge at hotmail.com
Thu May 6 09:37:07 EDT 2010
I'm trying to listen for data on port 6267 using a UDP socket. When I send
data to this socket, nothing happens. 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-not-firing-tp2132633p2132633.html
Sent from the Mono - General mailing list archive at Nabble.com.
More information about the Mono-list
mailing list