Tekkaman

导航

 

2012年9月24日

摘要: 【iOS之Payload、Trailer】 A packet generally contains three basic parts: a header that tells where the packet should be sent, a payload that contains the actual data, and a trailer that contains checksum information to ensure that the packet was received correctly. Some packet types include this checks. 阅读全文
posted @ 2012-09-24 14:51 Tekkaman 阅读(2244) 评论(0) 推荐(0)
 
摘要: 【iOS之线程间通信】 Cocoa为iOS线程间通信提供2种方式,1种是performSelector,另1种是Port。 先说第1种,performSelector,有以下几种: 第2种为NSMachPort方式。NSPort有3个子类,NSSocketPort、NSMessagePort、NSMachPort,但在iOS下只有NSMachPort可用。 使用的方式为接收线程中注册NSMachPort,在另外的线程中使用此port发送消息,则被注册线程会收到相应消息,然后最终在主线程里调用某个回调函数。 可以看到,使用NSMachPort的结果为调用了其它线程的1个函数,而这正... 阅读全文
posted @ 2012-09-24 10:21 Tekkaman 阅读(8202) 评论(2) 推荐(0)