read socket until crlf question
Dar Scott
dsc at swcp.com
Fri Jan 16 10:30:48 EST 2004
On Wednesday, January 14, 2004, at 09:35 PM, Doug Lerner wrote:
> If I
>
> read from socket thisSocket until CRLF
>
> and then look at the number of chars in it the number of chars is ONE
> plus
> the number of visible characters read. Why isn't it TWO plus the
> number of
> visible chararacters read - one for CR and one for LF?
Doug, it seems to me that, though you got plenty of "responses," you
didn't get an answer.
I usually do the line processing after receiving the data, so I usually
don't do it this way. Maybe 'until' only matches on the first
character. I don't get that impression from the TD (list jargon for
Transcript Dictionary), though.
If you are doing a repeat for each line or referring to 'line n of' you
will not get the LF.
The function below takes a string and converts it to hex. You can use
it to dump your line in testing. For example "abc" & crlf will be
translated to "6162630D0A". Look for 0D for CR and 0A for LF.
function hex s
get binaryDecode("H*",s,h)
return h
end hex
Dar Scott
More information about the use-livecode
mailing list