Re: sending data over udp
Hi Dan, must now use UDP and it appears that UDP simply sends PicoLisp data structures. Yes, that's true. I sends a single Lisp data item (number, symbol, or list). Prior to this, I was simply creating a list of byte-sized numbers and using wr to send them via TCP. Is there any way to do something similar using UDP? You mean, for example, by sending a list of numbers representing bytes? e.g. (udp Host Port (1 2 3 4 5 6 7)) By the way, this question is somewhat time sensitive. In the sense of urgency, or runtime speed? ;-) Cheers, - Alex -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Re: sending data over udp
Hi Dan, You mean, for example, by sending a list of numbers representing bytes? e.g. =A0 (udp Host Port (1 2 3 4 5 6 7)) Yes, but without the extra bytes for the list data structure. Unfortunately, the existing 'udp' function cannot do that. It can handle only Lisp data. You could make your own custom function, e.g. with inline-C using 'gcc' (load @lib/gcc.l) (gcc net NIL 'rawUdp) any rawUdp(any ex) { ... byte buf[UDPMAX]; ... fill 'buf' with bytes sd = socket(AF_INET, SOCK_DGRAM, 0) sendto(sd, buf, ...) close(sd); } /**/ but this is rather tedious, manipulating the buffer and byte data. I don't know any really easy way at the moment. How about writing raw bytes to a pipe or temp file, and using an external tool like 'nc' to actually transfer the data? Cheers, - Alex -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Re: sending data over udp
Thank you for the answer and the suggestions. I will look into them furthe= r. - dan On Sat, Aug 14, 2010 at 11:28 AM, Alexander Burger a...@software-lab.de wr= ote: Hi Dan, You mean, for example, by sending a list of numbers representing bytes= ? e.g. =3DA0 (udp Host Port (1 2 3 4 5 6 7)) Yes, but without the extra bytes for the list data structure. Unfortunately, the existing 'udp' function cannot do that. It can handle only Lisp data. You could make your own custom function, e.g. with inline-C using 'gcc' =A0 (load @lib/gcc.l) =A0 (gcc net NIL 'rawUdp) =A0 any rawUdp(any ex) { =A0 =A0 =A0... =A0 =A0 =A0byte buf[UDPMAX]; =A0 =A0 =A0... =A0 =A0 =A0fill 'buf' with bytes =A0 =A0 =A0sd =3D socket(AF_INET, SOCK_DGRAM, 0) =A0 =A0 =A0sendto(sd, buf, ...) =A0 =A0 =A0close(sd); =A0 } =A0 /**/ but this is rather tedious, manipulating the buffer and byte data. I don't know any really easy way at the moment. How about writing raw bytes to a pipe or temp file, and using an external tool like 'nc' to actually transfer the data? Cheers, - Alex -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=3dunsubscribe -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Re: sending data over udp
On Sat, Aug 14, 2010 at 11:28 AM, Alexander Burger a...@software-lab.de wr= ote: You could make your own custom function, e.g. with inline-C using 'gcc' =A0 (load @lib/gcc.l) =A0 (gcc net NIL 'rawUdp) =A0 any rawUdp(any ex) { =A0 =A0 =A0... =A0 =A0 =A0byte buf[UDPMAX]; You could look at misc/crc.l which does similar things, taking a byte count and a list of byte arguments: $ ./dbg misc/crc.l : (crc 9 (1 2 3 4 5 6 7 8 9)) - 16900 Cheers, - Alex -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
sending data over udp
A few weeks ago I asked about sending data over TCP. Well, my program must now use UDP and it appears that UDP simply sends PicoLisp data structures. Prior to this, I was simply creating a list of byte-sized numbers and using wr to send them via TCP. Is there any way to do something similar using UDP? By the way, this question is somewhat time sensitive. Thank you. - dan -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe