[Wylug-help] Perl Client 'recv' blocking under Win32

Simon Wood simon at mungewell.org
Fri Jan 7 04:21:06 GMT 2005


Hi all,
I've been tearing my hair out and swearing profussely at win32... I'm write a client (for both Unix/Win32) which will connect and talk to a TCP/IP->Serial convertor.

I decided that it was time to learn perl and so far its quite nice. The current problem I have is that my 'recv' call is blocking when there is no data coming from the 'server'.

Under Linux everything is happy, I can just do "$socket->blocking(0);", but windows is being a pain.....

I have tried to implement a select/can_read thing but this appears to block anyhow - perhaps I've balls'ed it up. Is this supposed to work for Client as well as Servers?

If not does any one have any other workarounds?

Simon.

Code goes...
----- creating socket

        $comms_port = new IO::Socket::INET(
            PeerAddr => $cfg->param("tcpip.host"),
            PeerPort => $cfg->param("tcpip.port"),
            Proto    => "tcp");

        $comms_select = IO::Select->new($comms_port);

----- when attempting to read (and not block)

    my @array = $comms_select->can_read;
    foreach my $fh (@array) {
    if ($fh == $comms_port) {
        $comms_port->recv( $data, 255 );

-----









More information about the Wylug-help mailing list