NSStream, parsing NSData to struct
NSStream, parsing NSData to struct
- Subject: NSStream, parsing NSData to struct
- From: Carlo Gulliani <email@hidden>
- Date: Thu, 9 Jul 2009 03:28:45 -0700 (PDT)
hello, i have NSData
...
NSData *d = [NSData dataWithBytes:(char*)&buffer length:len];
NSLog(@"%@", d); // <efbeadde 14000100 00000000 02100000 04000000 00000000 00000000 00000000 00185918 00000000 b08259d8 1e000000>
and I have structure
typedef struct mrim_header
{
u_long magic;
u_long proto;
u_long seq;
u_long msg;
u_long dlen;
u_longIP;
u_longPort;
u_charReserved[16];
}mrim_header;
how can i parse this data to this structure? In general, i should catch some unsigned long variable, i guess it's 1e000000 and it must be equal 30 so, before it i sent some packet and server returned to me these bytes, now i should parse it
Please, let me know how to do it!
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden