2011-05-24 44 views

回答

2

假设你知道如何在一般的发送数据,这里是代码:

uint8_t *bytes = (uint8_t)[myData bytes]; 
size_t length = [myData length]; 

sendBytesWithLength(bytes, length); 

在接收端重新生成你的NSData对象是这样的:

uint8_t *bytes = ; // Get the bytes from somewhere... 
size_t length = ; // And the length 

NSData *data = [[NSData alloc] initWithBytes:(const void *)bytes length:length]; 
+0

可我知道接收端的代码(指:转换字节至MYDATA的) – Christina 2011-05-24 09:39:30

+0

@Christina:当然,我有我的答案 – JustSid 2011-05-24 09:43:11

+0

感谢更新.... ........... – Christina 2011-05-24 09:45:43

1

您是否曾尝试在第一个地方查看Bonjour参考来建立连接?这应该引导您进入网络通信的其他选项。