Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想通过 TCP 向服务器发送两个字节,它们代表 big-endian 中的无符号短字节。但是 net-send 只支持字符串参数。谁能告诉我如何用 newLISP 做到这一点?
现在可以了。代码:全选
(set 'socket (net-connect "localhost" 8889)) 16 (set 'size (pack ">d" 19)) "\000\019" (net-send socket size) 2
pack 返回一个包含我的两个字节的字符串缓冲区,net-send 将字符串发送到服务器。我的 C++ 服务器有两个字节,0 和 19。谢谢。