int length = (int)[data length];
//将主机数转换成无符号长整型的网络[字节顺序]
HTONL(length);
int i = 1;
NSData *data = [NSData dataWithBytes: &i length: sizeof(i)];
int i;
[data getBytes: &i length: sizeof(i)];
htonl()--"Host to Network Long int" 32Bytes
ntohl()--"Network to Host Long int" 32Bytes
htons()--"Host to Network Short int" 16Bytes
ntohs()--"Network to Host Short int" 16Bytes