Setting line mode on a newly create connection.
[1/6] from: bga-bug::br::org::br at: 20-Apr-2006 14:01
Hello.
I am experimenting with TCP clients/servers in REBOL. I have a standard
server who listens for connections and accepts them. My problem is that
I didn't find a way to set these newly created ports to line mode. Any
ideas?
Also, I am not sure setting it to line mode will do what I expect it to.
Right now, if I send a single character from the client, this char will
be immediately processed by the server program and I don't want that to
happen before an entire line is sent. I know I could just concatenate al
chars until I have a line and then process it but this seems to be more
expensive than it must be.
Any help will be appreciated.
-Bruno
[2/6] from: anton::wilddsl::net::au at: 21-Apr-2006 19:41
How are you opening your connection to the server and
your listen port (server)?
Both should be opened in lines mode. See HELP OPEN.
So...
; client code
server: open/lines tcp://127.0.0.1:1234
; server code
listen: open/lines tcp://:1234
Anton.
[3/6] from: ale870::gmail::com at: 21-Apr-2006 12:25
Hello Anton,
do you know if there are any problems related to CR/LF if the client
is Ms Windows and server Un*x (or vice-versa), when we use /lines
mode?
Thank you!
--Alessandro
On 4/21/06, Anton Rolls <anton-wilddsl.net.au> wrote:
[4/6] from: gabriele:colellachiara at: 21-Apr-2006 16:20
Hi Alessandro,
On Friday, April 21, 2006, 12:25:06 PM, you wrote:
AM> do you know if there are any problems related to CR/LF if the client
AM> is Ms Windows and server Un*x (or vice-versa), when we use /lines
AM> mode?
On TCP REBOL always uses CRLF, on all platforms. They are
converted to LF when REBOL receives them, and back to the platform
convention if you write to a file. It's all transparent for you.
Regards,
Gabriele.
--
Gabriele Santilli <gabriele-rebol.com> --- http://www.rebol.com/
Colella Chiara software division --- http://www.colellachiara.com/
[5/6] from: ale870:gm:ail at: 21-Apr-2006 16:38
Great! Thank you! :-)
On 4/21/06, Gabriele Santilli <gabriele-colellachiara.com> wrote:
[6/6] from: anton::wilddsl::net::au at: 22-Apr-2006 1:51
Rebol should translate those correctly for you,
in the case of networking in /lines mode, you
shouldn't have to think about it.
If you should ever need to know, Rebol knows
which platform it is on, so it is possible to find:
4-Jun-2004
Determine host os's line-terminator character sequence.
(Carl Sassenrath's working method. Use this on a file
you are going to create anyway.)
p: open %tmp
line-flag: p/state/with
close p
(I only ever needed to know this for a file-splitting
application.)
Regards,
Anton.