Difference between revisions of "Designing network protocols"

From HashVB
Jump to: navigation, search
(Discussion log)
 
(Another log)
Line 30: Line 30:
 
<@QueenDee> if crlf exists, read up to it, and remove form buffer
 
<@QueenDee> if crlf exists, read up to it, and remove form buffer
 
<@QueenDee> repeat check for crlf
 
<@QueenDee> repeat check for crlf
 +
</pre>
 +
 +
<pre>
 +
<@QueenDee> each time you get "new data" you recieve it ALL into a string
 +
< Chris_Tucker> yes
 +
<@QueenDee> append it to a buffer which contains any pending data so far (set later on)
 +
<@QueenDee> THEN
 +
<@QueenDee> you look for a vbcrlf in that buffer
 +
< Chris_Tucker> ok
 +
<@QueenDee> if there is one, read up to it, process it and remove it form the buffer
 +
<@QueenDee> look for the crlf again
 +
<@QueenDee> if there is one, read up to it, process it and remove it form the buffer
 +
<@QueenDee> reapeta those steps UNTIL there is no more crlf
 +
< Chris_Tucker> i understand that, but i have never worked with buffers before, is it just a string?
 +
<@QueenDee> if you are lucky, you will have nothign left in teh buffer
 +
<@QueenDee> but it is possible you will have a few stray bytes left
 +
<@QueenDee> so you leave them for next time
 +
-!- Arhangel [~ed@netrun-56-17.cytanet.com.cy] has joined #vb
 +
<@QueenDee> yes.
 +
< Chris_Tucker> well, problem
 +
< Arhangel> has anyone had experience with RDL?
 +
< Chris_Tucker> i can see that if stuff piles up, it could end up in a VERY dangerous situation
 +
<@QueenDee> it wont pile up
 +
< Hypnotron> Chris_Tucker: you read in all data immediately in a loop and process it.  nothings gonna pile up
 +
<@QueenDee> because you read EVERYTHING that is in teh buffer that is "complete"
 +
<@QueenDee> the only thing potentiall left over is half a command
 +
<@QueenDee> which will be completed when the next lot of data is received
 
</pre>
 
</pre>

Revision as of 23:31, 30 November 2005

<@QueenDee> ok, so you can NOT rely on the data being recieved in the same chunks as they are snt
<@QueenDee> they will be in the same order, yes, but be broken into chunks as the server, and any devices along the route see
            fit
< lsdigital> well kinda
<@QueenDee> So, you need to receive ALL data into one buffer
< lsdigital> yeh
< lsdigital> like
<@QueenDee> there is no kinda about it
<@QueenDee> thats how it is
< lsdigital> i hwell
< lsdigital> there is only one server
< lsdigital> but ya
< lsdigital> all of it comes at once
< lsdigital> and
< lsdigital> vb isnt parsing it all
< lsdigital> ill get like
< lsdigital> the first 5 lines
<@QueenDee> shut up and listen
<@QueenDee> that is EXACTLY what I have just explianed
< lsdigital> k
< Deathmaster> LOL dee is already nervous ;))
<@QueenDee> the chunks the server sends will NOT be the chunks you receive
< logicerror> lol
<@QueenDee> there needs to be some delimiter character (new line normally) to say process this
<@QueenDee> so...
<@QueenDee> you read all your data into a single buffer, then parse that
<@QueenDee> read data in and append to buffer
<@QueenDee> check for crlf
<@QueenDee> if crlf exists, read up to it, and remove form buffer
<@QueenDee> repeat check for crlf
<@QueenDee> each time you get "new data" you recieve it ALL into a string
< Chris_Tucker> yes
<@QueenDee> append it to a buffer which contains any pending data so far (set later on)
<@QueenDee> THEN
<@QueenDee> you look for a vbcrlf in that buffer
< Chris_Tucker> ok
<@QueenDee> if there is one, read up to it, process it and remove it form the buffer
<@QueenDee> look for the crlf again
<@QueenDee> if there is one, read up to it, process it and remove it form the buffer
<@QueenDee> reapeta those steps UNTIL there is no more crlf
< Chris_Tucker> i understand that, but i have never worked with buffers before, is it just a string?
<@QueenDee> if you are lucky, you will have nothign left in teh buffer
<@QueenDee> but it is possible you will have a few stray bytes left
<@QueenDee> so you leave them for next time
-!- Arhangel [~ed@netrun-56-17.cytanet.com.cy] has joined #vb
<@QueenDee> yes.
< Chris_Tucker> well, problem
< Arhangel> has anyone had experience with RDL?
< Chris_Tucker> i can see that if stuff piles up, it could end up in a VERY dangerous situation
<@QueenDee> it wont pile up
< Hypnotron> Chris_Tucker: you read in all data immediately in a loop and process it.  nothings gonna pile up
<@QueenDee> because you read EVERYTHING that is in teh buffer that is "complete"
<@QueenDee> the only thing potentiall left over is half a command
<@QueenDee> which will be completed when the next lot of data is received