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

Re: CFSocket questions


  • Subject: Re: CFSocket questions
  • From: Becky Willrich <email@hidden>
  • Date: Fri, 6 Sep 2002 09:53:35 -0700

1.) I have read that if I use CFSocketConnectToAddress with a timeout of -1 it will connect in the background. And...If it connects in the background I can add the callback "kCFSocketConnectCallBack" to my already existing callback of "kCFSocketDataCallBack". Is this correct? And if so how is this accomplished?

am using code like the following which adds the Data callback:
CFSocketRef s = CFSocketCreate(NULL, PF_INET, SOCK_STREAM, IPPROTO_TCP,
kCFSocketDataCallBack, whatToDo, NULL);

How do I add the second callback???

CFSocketRef s = CFSocketCreate(NULL, PF_INET, SOCK_STREAM, IPPROTO_TCP,
kCFSocketDataCallBack | kCFSocketConnectCallBack, whatToDo, NULL);


2.) Can I reference the native socket directly while using CFSocket? So for example using the native socket's send(). If so how do I go about this and is there any benefit/downside to doing this?

Yes; if you don't already have the native socket, you can get it from CFSocket via CFSocketGetNative(). I don't know of any win in calling send() directly as opposed to calling CFSocketSendData(), though. But I don't think it does any harm, either. Note that if you will be sending large amounts of data (enough that you might block), you will want to register for the kCFSocketWriteCallBack as well, so you don't block in send() (or CFSocketSendData()).

REW
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.

References: 
 >CFSocket questions (From: "Edward Fink" <email@hidden>)

  • Prev by Date: Re: OT vs. socket calls on 10.2
  • Next by Date: Re: CFSocket questions
  • Previous by thread: CFSocket questions
  • Next by thread: Re: CFSocket questions
  • Index(es):
    • Date
    • Thread