Hi, I am very, very interested in the non-blocking features of Mojolicious
and its server, but I am blocked in my first try.
This is a simple remote port test:
use Socket;
my ($ip, $protocol, $port, $myhouse, $yourhouse, $log);
$ip = $site->{ip};
$port = $site->{port};
$protocol = getprotobyname('tcp');
socket(SOCKET, PF_INET, SOCK_STREAM, $protocol);
$yourhouse = inet_aton($ip);
$myhouse = sockaddr_in($port, $yourhouse);
if (!connect(SOCKET, $myhouse)) {
$site->{status} = 'KO';
} else {
$site->{status} = 'OK';
close SOCKET || die "close: $!";
}
I am using Morbo for executing it. And I have other pages in the app.
When the remote IP and port are OK, it works fine. But if I use a wrong
(not responding or fake) IP, it hangs, waiting forever,* and I can't use
any other pages in the application*. Those pages wait until I cancel this
process.
I do not want a timeout, but the non-blocking "promise".
Do I need to manage events for such a little function (like I should do in
ActionScript, for example)? If so, it seems that there is no such thing as
a non-blocking feature, isn't it?
I think that there is something very, very basic about the non-blocking
"way of life" that I am missing. Any help very appreciated.
Regards:
Nacho B
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/groups/opt_out.