Re: Script execution blocked when reading from a socket



Mark <nospam@xxxxxxxxxxxxxxxx> wrote in comp.lang.perl.misc:
> "Anno Siegel" <anno4000@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
> >>
> >> # Select() is supposed to succeed if the socket has data,
> >> # or else timeout and return FALSE.
> >> if (!(select (SOCK, undef, undef, 10.0))) {goto NEXT_IP;}
> >
> > Select guarantees that at least on character is available. You
> > are trying to read an entire line. Try reading a single character.
>
> Is this what you are suggesting?
>
> if (!recv(SOCK, $line, 1, 0)) {goto NEXT_IP;}

It is, or rather, it was before I noticed you are not using select() right.
In particular, the first argument isn't a filehandle but a bit vector of
file numbers. See perldoc -f select. The standard module IO::Select takes
care of the technicalities.

> I tried this, but my script still hangs up on the same IP
> addresses that caused problems before.

Well, so far you have been relying on random results from select().
Try the real thing.

Anno
--
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers.
.



Relevant Pages

  • Re: Script execution blocked when reading from a socket
    ... >> # Selectis supposed to succeed if the socket has data, ... >> # or else timeout and return FALSE. ... Try reading a single character. ... Prev by Date: ...
    (comp.lang.perl.misc)
  • Re: Script execution blocked when reading from a socket
    ... > The script will usually scan a few addresses, ... > The hangup occurs when attempting to read from the socket. ... Try reading a single character. ... "Reply" at the bottom of the article headers. ...
    (comp.lang.perl.misc)
  • Re: pop bumper bulbs keep blowing out
    ... One thing you may want to do is float the socket a little above the ... bottom of the pop bumper body. ... and two fire simultaneously. ...
    (rec.games.pinball)
  • Re: Lamp Socket Question
    ... >have to remove the light socket from the wiring. ... The top pushes into the bottom. ... For those who may not recognize what a lamp harp is, ...
    (alt.home.repair)
  • Re: Singer 306 machine
    ... that pic near the bottom left of the page looks just like my socket. ... DH probably can do it for you if you have the plug ... The cord from the outlet to the machine is all there, ...
    (rec.crafts.textiles.quilting)