2012-02-23 39 views
-2

我需要创建一个与设备上运行的服务器的TCP连接,我需要在以下格式连接后发送二进制数据。如何创建与tcp服务器的连接

 Field   Byte  Value 
    1: packet id  1   0X01 
    2: length   1   2 
    3:Buadrate  4  The bit rate in bps used by the can 
          BUS. Maximum value is 1000000. 

    4:extended   1  If this is set to one the device will use 
          the extended frame format 

请帮助该如何创造与服务器上的2000端口上运行的TCP连接 请帮

回答

0

我建议你考虑使用CocoaAsyncSocket这将缓解一些吧......

https://github.com/robbiehanson/CocoaAsyncSocket

https://github.com/robbiehanson/CocoaAsyncSocket/wiki/Intro

当你有你socke您可以发送(writeData:)您的数据作为C结构,但您可能需要为波特率选择的端点。检查一下。

+0

我已创建与设备的连接,但我没有得到如何发送以上数据 – Ali 2012-03-04 15:27:41

+0

这将是MSB第一 – Ali 2012-03-04 15:28:16

相关问题