net-functions

Q&A's, tips, howto's
Locked
newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

net-functions

Post by newdep »

Hello Lutz,

When i use it in combination with C functions i need to put
and extra "\000" at the end of every received n-size buffer data using a 'set.

When I use i.e. (set 'buff (net-receieve ....)) its probably by origin "\000" terminated but the 'set makes it a list (string) which removes it again...

Just for the verification...

Norman..
-- (define? (Cornflakes))

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

actually only the (print ..) or (println ..) and (string ...) function strips the 'C' zero. 'get-string' will also do it, so when you use 'get-string' on an imported 'C' function and then do net-send that string you will not send the trailing zero. But else 'set' and the 'net-functions' in pretty much all other functions working on string-buffers can work on binary data:

'set' and the net-xxxx fucntions don't do this:

Computer one:

(net-send socket "\000\001\002\003\000") => 5 ; characters send

Computer two:

(net-receive sock 'buff 20) => 5 ; characters received

buff => "\000\001\002\003\000"

(string buff) => ""

Lutz

Locked