ClosestStorm / v8cgi

Automatically exported from code.google.com/p/v8cgi
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Second call to socket.receive hangs script execution. #42

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I took your code from http.js 

var received = "";
do {
    var part = s.receive(1024, true);
    for (var i=0;i<part.length;i++) {
        received += String.fromCharCode(part[i]);
    }
} while (part.length > 0);

an it hangs script execution on second s.receive(1024, true) call.

v8cgi compiled from latest sources on Ubuntu 9.10

Original issue reported on code.google.com by neoco...@gmail.com on 17 Nov 2009 at 11:33

GoogleCodeExporter commented 9 years ago
In what scenario do you use this code? Please note that receive() works 
*exactly* as
recvfrom(2) with no additional flags, i.e. if there is no message available, 
this
call blocks. From this point of view, the reported behavior looks rather like a
feature and not a bug.

Original comment by ondrej.zara on 17 Nov 2009 at 1:38

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
You right. It works like it should. It was my misunderstanding. Sorry for 
taking your
time. Please delete this issue.

Original comment by neoco...@gmail.com on 17 Nov 2009 at 7:01

GoogleCodeExporter commented 9 years ago

Original comment by ondrej.zara on 17 Nov 2009 at 8:17

GoogleCodeExporter commented 9 years ago
So how would one create a non-blocking socket? I am having trouble with this as 
the connection I'm using is being kept alive by the server until explicitly 
killed by the client.

Original comment by me%stuar...@gtempaccount.com on 13 Jul 2010 at 5:03

GoogleCodeExporter commented 9 years ago
As far as I know, there is no way to do this at the moment. What API do you 
propose? Some kind of fcntl(), or as an option to receive()? 

Original comment by ondrej.zara on 13 Jul 2010 at 6:37