http://qs1969.pair.com?node_id=97879


in reply to Parsing data from a data feed

Well, this is what i had to change it to, now it works perfect:
do { $socket->recv($response, 1); $data = $data . response; } until ($response eq "\0x00");
As far as the rest is concerned, I cannot read using getline I think, and I cannot read til EOF because there is no EOF, as I said the datafeed goes on forever. You may be right though, I'll check into that.
Thanks Tons!
Apterigo

Replies are listed 'Best First'.
Re: Re: Parsing data from a data feed
by bikeNomad (Priest) on Jul 19, 2001 at 01:18 UTC
    I don't know why getline wouldn't return a record at a time if you set $/ to "\x00". The advantage of doing it this way is that you should burn less CPU time, because the low-level (C) code is actually handling the incoming characters and you get full records. Generally, the less times you can manage to go through a loop, the better. So your get-a-record routine would be just:

    my $response; { local $/ = chr(0); # or "\x00" $response = $socket->getline }