Re: Script execution blocked when reading from a socket
- From: anno4000@xxxxxxxxxxxxxxxxxxxxxxx (Anno Siegel)
- Date: 17 Jan 2006 16:38:45 GMT
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.
.
- Follow-Ups:
- References:
- Script execution blocked when reading from a socket
- From: Mark
- Re: Script execution blocked when reading from a socket
- From: Anno Siegel
- Re: Script execution blocked when reading from a socket
- From: Mark
- Script execution blocked when reading from a socket
- Prev by Date: Re: ExpatXS: 'Can't call method "read" on an undefined value' after ca. 500 XML files
- Next by Date: Re: Creating and outputting a generic data structure?
- Previous by thread: Re: Script execution blocked when reading from a socket
- Next by thread: Re: Script execution blocked when reading from a socket
- Index(es):
Relevant Pages
|