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

CFSocketCreateRunLoopSource crashes


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

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

  • Follow-Ups:
    • Re: CFSocketCreateRunLoopSource crashes
      • From: Jaime Magiera <email@hidden>
    • Re: CFSocketCreateRunLoopSource crashes
      • From: Liwei <email@hidden>
  • Prev by Date: Re: What is the "preference path" in "SCPreferencesPathGetValue" ?
  • Next by Date: Re: CFSocketCreateRunLoopSource crashes
  • Previous by thread: Re: A problem of WebCtrlEventListerer setCallerCtx
  • Next by thread: Re: CFSocketCreateRunLoopSource crashes
  • Index(es):
    • Date
    • Thread