2011-05-24 45 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參考來建立連接?這應該引導您進入網絡通信的其他選項。