• 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: CFSocketCreateRunLoopSource crashes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CFSocketCreateRunLoopSource crashes


  • Subject: Re: CFSocketCreateRunLoopSource crashes
  • From: Liwei <email@hidden>
  • Date: Sun, 24 Aug 2008 17:03:01 +0800

Also, pardon the missing CFRunLoopRun(), it is lower down my code.

2008/8/24 Liwei <email@hidden>:
> Hmm... Somehow the following code crashes while trying to create the
> runloop source:
>        struct sockaddr_in a = {0, AF_INET, htons(5555), 0};
>        CFDataRef d = CFDataCreate(kCFAllocatorDefault, (UInt8 *)&a,
> sizeof(struct sockaddr_in));
>        CFSocketSignature signature = {PF_INET, SOCK_DGRAM, IPPROTO_UDP, d};
>        CFSocketRef socket =
> CFSocketCreateWithSocketSignature(kCFAllocatorDefault, &signature,
> kCFSocketDataCallBack, receiveData, NULL);
>        CFRunLoopSourceRef source =
> CFSocketCreateRunLoopSource(kCFAllocatorDefault, socket, 0);
>        CFRunLoopRef loop = CFRunLoopGetCurrent();
>        CFRunLoopAddSource(loop, source, kCFRunLoopDefaultMode);
> The weird thing is that without htons() the code runs, but I don't
> think the socket works. I'm on Intel by the way.
>
> Anyone with any ideas?
>
 _______________________________________________
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: 
 >CFSocketCreateRunLoopSource crashes (From: Liwei <email@hidden>)

  • Prev by Date: CFSocketCreateRunLoopSource crashes
  • Next by Date: Re: CFSocketCreateRunLoopSource crashes
  • Previous by thread: CFSocketCreateRunLoopSource crashes
  • Next by thread: Re: CFSocketCreateRunLoopSource crashes
  • Index(es):
    • Date
    • Thread