Thread: Stepping Through Lines In A Buffer

  1. #16
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    Yes: Beginning

    If you have questions like this I suggest starting a new thread. You've about hijacked this one as this isn't helping the OP.
    If you understand what you're doing, you're not learning anything.

  2. #17
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    Not. You're making the incorrect assumption that he's reading in one line at a time. Again...documentation. Directly from the RFC that the OP mentioned in the very first post of this thread:
    Responses to certain commands are multi-line. In these cases, which
    are clearly indicated below, after sending the first line of the
    response and a CRLF, any additional lines are sent, each terminated
    by a CRLF pair.
    If you understand what you're doing, you're not learning anything.

  3. #18
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    EOF cannot be stored in a char. Must you crap up every thread?


    Quzah.
    Hope is the first step on the road to disappointment.

  4. #19
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,273
    MDofRockyView: I'll be happy to fully document my code for you when it's finished.

    Can't work on it at the mo as I'm in work, but I got a few ideas from my sleep last night (as you do). Gonna turn this "jumping through lines" bit into a function that returns null-terminated lines from the buffer until it reaches the end.

    But essentially the size of the message as reported by the LIST command isn't being matched by my code as it goes through the lines and counts the bytes it has read.

    You might think it's a bit of a pointless act but the whole idea behind it is to flick through the buffer as the packets come in and extract header information. As there isn't any standard mechanism with which I can get the headers (If you're gonna reply with "TOP", don't bother, it's an optional command and isn't implemented on the server I'm talking to) and I don't want to store the entire message and then read through it I'm taking the streaming approach.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Multithreading (flag stopping a thread, ring buffer) volatile
    By ShwangShwing in forum C Programming
    Replies: 3
    Last Post: 05-19-2009, 07:27 AM
  2. writing a pack-style function, any advices?
    By isaac_s in forum C Programming
    Replies: 10
    Last Post: 07-08-2006, 08:09 PM
  3. Having Buffer Problems With Overlapped I/O --
    By Sargera in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 04:46 PM
  4. recv multiple lines
    By TCM in forum Networking/Device Communication
    Replies: 11
    Last Post: 07-13-2004, 04:54 PM
  5. count only lines of code...
    By flightsimdude in forum C Programming
    Replies: 13
    Last Post: 09-23-2003, 07:08 PM