Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-blocking Socket.Send (a bit too non-blocking) #5

Closed
mszubart opened this issue Oct 26, 2012 · 2 comments
Closed

Non-blocking Socket.Send (a bit too non-blocking) #5

mszubart opened this issue Oct 26, 2012 · 2 comments

Comments

@mszubart
Copy link

I've got my copy of crossroads-net from github (cloned) so it is the latest version.
I'm using libxs 1.2.0; .NET 4.5; Win7 x64 (but all libs are 32bit)
My problem is:

sock.Send(data, data.Length, SocketFlags.None);

What should happen (and does in C/C++):
This expression should block current thread and wait until data is received by another socket.

What is really happening:

Console.Write("A");
sock.Send(data, data.Length, SocketFlags.None);
Console.Write("B");

If server (socket receiving data) is not running, it prints 'AB' and exits.
If I add something like 'wait key' and then run server, data is being received.

It would be nice to have blocking version of Socket.Send.

Thank you.
And I apologize for my English.

@edwinchenloo
Copy link

There are no guarantees as to when the receiver gets or processes data being sent to it.

Is the question/concern to make Send() block until the bytes have been delivered to the network stack?

@mszubart
Copy link
Author

After 4 months I barely remember what I meant but I remember that different language bindings worked in a different ways (c++ version was blocking, java not).

Crossroads doc says:

A successful invocation of xs_send() does not indicate that the message has been transmitted to the network,
only that it has been queued on the socket and Crossroads have assumed responsibility for the message.

Let's stick to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants