Bug 30871 - UdpClient receive bug
Summary: UdpClient receive bug
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System (show other bugs)
Version: 4.0.0
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-06-06 19:49 UTC by Justin
Modified: 2017-09-01 11:34 UTC (History)
3 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Test receiver (4.14 KB, text/plain)
2015-06-06 19:49 UTC, Justin
Details

Description Justin 2015-06-06 19:49:27 UTC
Created attachment 11494 [details]
Test receiver

I've been writing a simple program in C# making use of the UdpClient class.  I develop on Windows and copy the binary to my Linux box.

It seems that sometimes the array of Bytes received contain useful information, but sometimes the array consists only of 0x00s although the number of bytes received is correct.

This is what I'd see if sensible data was being received:

user@computer:~/folder$ ./ConsoleApplication1.exe
68 64 00 2A 71 61 00 AC CF 23 35 22 74 20 20 20 20 20 20 74 22 35 23 CF AC 20 20 20 20 20 20 53 4F 43 30 30 35 00 03 1E D9 00

68 64 00 2A 71 61 00 AC CF 23 35 22 74 20 20 20 20 20 20 74 22 35 23 CF AC 20 20 20 20 20 20 53 4F 43 30 30 35 04 03 1E D9 00

68 64 00 2A 71 61 00 AC CF 23 35 22 74 20 20 20 20 20 20 74 22 35 23 CF AC 20 20 20 20 20 20 53 4F 43 30 30 35 07 03 1E D9 00


Here's what I see, some of the time:

user@computer:~/folder$ ./ConsoleApplication1.exe
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00



It may be worth noting that in my main program, the first few arrays received are correct, then everything subsequent to that seems to be zeroed out.

I've attached a simple test program that prints out as above whatever it receives.  To try it, please send data to port 10000.
Comment 1 Justin 2015-06-09 09:03:50 UTC
Update:  If I use UdpClient.Receive() rather than UdpClient.BeginReceive()/EndReceive() then I seem to be getting much further!  So, it looks like the problem may be limited to the async methods.

Hope this is of use.

Note You need to log in before you can comment on or make changes to this bug.