Hi,

I need to send a sequence of 694 bytes to a TCP port.  My quetion is: How do 
I collect these bytes?  (In Smalltalk I would use a ByteArray).

I need to send, for example:

    694 as unsigned short (2 bytes)
    251 as unsigned long (4 bytes)
    1 as unsigned short (2 bytes)
    ...
    "2000-02-18-15.01.57.000000", padded left with spaces,
        as 28 byte character field
    ...
    0, padded left with 0's, as 12 byte numeric field
    ...

My first reaction is to write functions like the following, but I don't know 
what to use for the byte-stream.  Suggestions for other approaches also 
welcome.

add-u-long func [
    integer [integer!] byte-stream [????]
    /local byte
][
    for shift-amount -24 0 8 [
        byte: bit-and (bit-shift integer shift-amount) 255
        append byte-stream byte
]

Thanks in advance,

Stan
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

Reply via email to