我感觉楼主是要用go,收json,然后转成私有udp发出去。
【 在 flw 的大作中提到: 】
: 你这里的 test.abc = 5 最好改成 test.abc = htons(5),
: 然后 Go 这边你用 encoding/binary 就可以读了,参见:
:
: $ go doc encoding/binary.Read
: package binary // import "encoding/binary"
:
: func Read(r io.Reader, order ByteOrder, data interface{}) error
: Read reads structured binary data from r into data. Data must be a pointer
: to a fixed-size value or a slice of fixed-size values. Bytes read from r are
: decoded using the specified byte order and written to successive fields of
: the data. When decoding boolean values, a zero byte is decoded as false, and
: any other non-zero byte is decoded as true. When reading into structs, the
: field data for fields with blank (_) field names is skipped; i.e., blank
: field names may be used for padding. When reading into a struct, all
: non-blank fields must be exported or Read may panic.
:
: The error is EOF only if no bytes were read. If an EOF happens after reading
: some but not all the bytes, Read returns ErrUnexpectedEOF.
: --
发自「今日水木 on 鸿蒙」
--
FROM 73.93.166.*