• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSStream, parsing NSData to struct
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: NSStream, parsing NSData to struct
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: bypass NSApp
  • Next by Date: Re: NSStream, parsing NSData to struct
  • Previous by thread: Re: Confused about NSPrintInfo margins
  • Next by thread: Re: NSStream, parsing NSData to struct
  • Index(es):
    • Date
    • Thread