• 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
Re: network related question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: network related question


  • Subject: Re: network related question
  • From: "Quinn \"The Eskimo!\"" <email@hidden>
  • Date: Wed, 05 Feb 2014 10:01:59 +0000

On 4 Feb 2014, at 19:37, Jeremy Thompson <email@hidden> wrote:

> I just need the handle variable to have all the buffer data.

Sounds like you need PtrToHand.  For example:

static Handle NewHandleForCFData(CFDataRef d)
{
    OSStatus err;
    Handle   h;

    err = PtrToHand(
        CFDataGetBytes(d),
        &h,
        CFDataGetLength(d)
    );
    assert(err == noErr);

    return h;
}

This is going to need some type casts to deal with things like the fact that CFDataGetLength returns a CFIndex which isn't always the same as long, which is what PtrToHand takes as its the size parameter.  I'd know what those edge cases were if I'd actually compiled and run this code, which I didn't (-:

Share and Enjoy
--
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >network related question (From: Jeremy Thompson <email@hidden>)

  • Prev by Date: Re: network related question
  • Next by Date: Re: listener missing lots of udp broadcasts
  • Previous by thread: Re: network related question
  • Next by thread: Re: listener missing lots of udp broadcasts
  • Index(es):
    • Date
    • Thread