[Mono-list] Has Anyone Read UDP Data with Mono?

Steve Ricketts velocedge at hotmail.com
Fri May 7 13:59:06 EDT 2010


If anyone has ever successfully used UDP to receive data, I'd dearly love to
see a sample of how it was done.  I tried to use every example I could find
on the internet for Sockets and UdpClients and nothing works.  Here is as
simple of a test program that I could:

byte[] data = new byte[1024];
IPEndPoint ipep = new IPEndPoint(IPAddress.Any, 6267);
Socket newsock = new Socket(AddressFamily.InterNetwork,SocketType.Dgram,
ProtocolType.Udp);
newsock.Bind(ipep);
IPEndPoint sender = new IPEndPoint(IPAddress.Any, 0);
EndPoint Remote = (EndPoint)(sender);
recv = newsock.ReceiveFrom(data, ref Remote); //  <-  never gets out of here

Here's the output of the sniffer on the receiving PC showing the data is
coming to port 6267:

238 Byte, Timestamp (1273185434.217237 s) 
 [ MAC (08:00:45:00:00:e0 => 40:61:86:4f:6b:06), Proto (0x0800) ] 
 [ Addr (192.168.1.67 => 192.168.1.66), Proto (17), TTL (128), TOS (0), Ver
(1024), IHL (1280), Tlen (224), ID (29148), Frag off (0), Chsum (0x445b) ] 
 [ Port (6279 => 6267), Len (204), Chsum (0xf603) ] 
 [ Payload hex  (d8 e8 98 9d 84 4c 61 da 24 cf 23 75 8f 61 5d d7 95 ec ab 4a
61 aa d8 8e 0a 45 57 a1 49 e6 70 15 64 91 
   4d b1 14 96 54 24 47 8b c2 1a d8 a5 66 c9 7f 65 16 2a 56 36 4d 4e f1 1a
b8 6d 22 95 0d 96 f9 1c e2 f4 2d 41 d4 40 95 
   c4 a1 5c 47 7a 2f f7 0a 41 2b 4f ae a6 44 cc 00 78 b5 6d 89 64 95 d2 59
4d ef 10 14 42 0b d3 90 ea 16 a0 76 1c c9 cd 
   76 92 14 6b b2 f3 16 c6 5e 6c 34 66 95 29 1b 9d d6 cd 61 c4 d2 49 23 97
2b 61 f2 56 8f ad d7 aa 40 2f d9 fe 23 6c 4f 41
   39 b6 c0 68 9d f0 d9 49 2e 16 ba 51 a8 20 72 be 16 a6 ad de c6 cb d3 16
aa fa 9d dd ad ed 12 ea b8 a4 b2 81 01 ) ] 

If you have a snippit of code that receives data from a UDP socket, I can't
tell you how much I would like to see it.

-- 
View this message in context: http://mono.1490590.n4.nabble.com/Has-Anyone-Read-UDP-Data-with-Mono-tp2135475p2135475.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list