C#服务端要求接收的数据包格式为UInt16类型的2位,UInt32类型的4位,String类型的8位,Byte类型的1位...
目前我用NSMutableData组成请求数据包发送给C#服务端,但是返回结果错误提示,高手赐教下,这种post请求要如何发送呢?
我现在是用ASIHTTPRequest进行post。
问题应该出在组装请求数据这里。
我目前是这样组装的:
NSMutableData *dt = [[NSMutableData alloc] initWithCapacity:2];
short s_dt = 123456;
[dt appendBytes:&s_dt length:2];
NSMutableData *dt2 = [[NSMutableData alloc] initWithCapacity:4];
int i_tt = 1345678;
[dt2 appendBytes:&i_tt length:4];
NSMutableData *dt3 = [[NSMutableData alloc] initWithCapacity:1];
char c_st = 1;
[dt3 appendBytes:&c_st length:1];
NSMutableData * writer = [[NSMutableData alloc] init];
[writer appendData:dt];
[writer appendData:dt2];
[writer appendData:dt3];