iPhone将字节写入套接字



我的应用程序中有一个输出流,我只想向该流写入3个字节。有人见过一个好例子吗?字节为:

Byte command1 = 254;
Byte command2 = 108;
Byte command3 = 1;

感谢

感谢您的投票。

我从另一位程序员发布的一些示例软件中找到了我问题的答案。以下是示例代码:

Byte *commandBytes = malloc(3);
commandBytes[0] = (Byte)254;
commandBytes[1] = (Byte)108;
commandBytes[2] = (Byte)1;
[outputStream write:(uint8_t *)commandBytes maxLength:3];

希望这能在将来帮助到别人。

最新更新