Algorithm for reading from continuous stream
From: Chee Liang (cheeliang_at_DIESPAM.iname.com)
Date: 03/01/04
- Next message: Michael Wojcik: "Re: PHP - I give up."
- Previous message: Matthew Hanna: "MS Degree Question"
- Next in thread: James Harris: "Re: Algorithm for reading from continuous stream"
- Reply: James Harris: "Re: Algorithm for reading from continuous stream"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 02 Mar 2004 00:53:05 +0800
Hi all,
I don't have much experience with reading from continuous stream (I
hope I'm using the right term here) as opposed to nicely packet-ed
methods like readline, gets, fgets, etc. Thus hope to get some ideas
on how to go about doing it.
Say I have a winsock stream, and I wish to read in line by line
(separated by newline). How can I go about doing that neatly? How
about variable sized packets from the socket?
After reading in the 1st time, and processing, I'm sure to have left
over bytes and the end of the buffer. How can I combine this neatly
with the next read from the socket? Circular buffer? I thought of
using a 2*n buffer, but it still might overflow unless every line is
<=n size.
Hope my questions isn't too vaguely phrased.
Thanks a lot!
- Next message: Michael Wojcik: "Re: PHP - I give up."
- Previous message: Matthew Hanna: "MS Degree Question"
- Next in thread: James Harris: "Re: Algorithm for reading from continuous stream"
- Reply: James Harris: "Re: Algorithm for reading from continuous stream"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|