Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Why sysread() + select() only read the first line?

by perlmonks12 (Novice)
on May 13, 2010 at 22:47 UTC ( [id://839918]=perlquestion: print w/replies, xml ) Need Help??

perlmonks12 has asked for the wisdom of the Perl Monks concerning the following question:

Hi I'm using sockets and I'm using to see when there is data to be read, I'm using in this way.
ready = $select->can_read(5); if (! scalar(@ready)) { print "Timed out\n"; } else { $sock = $ready[0]; if (! sysread($ready[0], $msg, 512)) { print "recv failed :$!\n"; } else { print "$msg"; } }
The code tell me when there is something to be read and it read it and print on the screen. However, it just print the first line, while the answer is much bigger, the first line is like 45 chars + \r\n\r\n and then it has more 300 bytes or so, that are never displayed. However, if I start tcpdump I can see this data coming, but never displayed. What I'm doing wrong? Thanks.

Replies are listed 'Best First'.
Re: Why sysread() + select() only read the first line?
by ikegami (Patriarch) on May 14, 2010 at 03:05 UTC
Re: Why sysread() + select() only read the first line? ($|)
by tye (Sage) on May 14, 2010 at 03:05 UTC
Re: Why sysread() + select() only read the first line?
by choroba (Cardinal) on May 13, 2010 at 23:02 UTC
      Thanks all, it solved the problem.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://839918]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-04-19 05:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found