Bug 4674 - Socket.BeginReceive never calls callback
Summary: Socket.BeginReceive never calls callback
Status: RESOLVED NORESPONSE
Alias: None
Product: Class Libraries
Classification: Mono
Component: System (show other bugs)
Version: 2.10.x
Hardware: All All
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-04-26 15:18 UTC by paul firth
Modified: 2018-03-13 11:07 UTC (History)
4 users (show)

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

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NORESPONSE

Description paul firth 2012-04-26 15:18:45 UTC
Hi there,

I'm having a problem with asynchronous socket calls...

BeginReceive never has its callback called. Using the following code:

SocketError error;
socket.BeginReceive(context.Buffer, 0, context.Buffer.Length, SocketFlags.None, out error, DoReceive, context);

The callback DoReceive is never called. The error is output as 'Success'.

Manually calling socket.Receive(context.Buffer) results in correct data.

I've tested this on windows mono build version 2.10, 2.10.8 and linux centos mono build version 2.10.2 and all have the same result.

When run on .NET built for windows, there is no such problem.

Cheers, Paul.
Comment 1 Gonzalo Paniagua Javier 2012-04-26 17:50:57 UTC
I am sure that if I try this it will work because I will not be testing *exactly* the same code that you tested. Please, attach a self-contained test case that helps us reproduce the problem.
Comment 3 Gonzalo Paniagua Javier 2012-04-27 10:39:58 UTC
I get an error for both projects: error CS2001: Source file `TcpServer.cs' could not be found

Ideally, you should try to extract a smaller test case. Just as you don't want to debug mono, I don't want to debug your code ;-). Are you familiar with tcpdump/wireshark? It would also help to get the output of that. Perhaps there is no actual data available to read and that's why the callback in BeginReceive() is never called.
Comment 4 paul firth 2012-04-27 10:50:05 UTC
Sorry, the solution you need to build is here:

CSServer\CSServer.sln

I've just retested and it compiles from fresh fine in VS2010.

Did you try the tests I suggested on the binaries which are indeed inside that zip file? They demonstrate the problem and show that it is not data related.

CSServer/bin/Debug/CSServer.exe

you need to be in directory CSServer/bin/Debug/ before you run mono because it requires a dll which is located there.

Cheers, Paul.
Comment 5 Nathan 2012-09-16 18:52:01 UTC
I also had this problem (I was using the Alchemy Websockets code) with Windows and 2.10.8. I fought with this all day, the callback of the beginReceive was never getting called. It worked just find using .Net instead of Mono.
I upgraded to the 2.11.4 Alpha and now the callback is being called.
Comment 6 Marek Safar 2018-03-13 11:07:37 UTC
We have not received the requested information. If you are still experiencing this issue please provide all the requested information and reopen the bug report.

Thank you!