• 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: CSocket callback keeps giving my Data instead of Read
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CSocket callback keeps giving my Data instead of Read


  • Subject: Re: CSocket callback keeps giving my Data instead of Read
  • From: Douglas Davidson <email@hidden>
  • Date: Thu, 6 Oct 2005 17:50:27 -0700


On Oct 6, 2005, at 5:39 PM, Ken Baer wrote:

I am implementing a port of WinSock to the Mac using BSD sockets, and I have a function that is setting up the network event callbacks.  I am creating a CFSocket from the SOCKET, setting up the callback types, creating a runloop source and adding it to the runloop.  I have even taken steps to set the socket flags with CFSocketSetSocketFlags() to no automatically reenable the kCFSocketDataCallBack, and also called CFSocketDisableCallBacks() for kCFSocketDataCallBack.


I am getting callbacks, like Connect, and Write, but the problem is that I get kCFSocketDataCallBack, and NOT kCFSocketReadCallBack.  My code wants to use the Read method, not the buffered Data method.  Somehow it keeps getting turned on, even after I told it not to (bad, bad CFSocket!).  Here is the code segment I am using to set this up.  Is there another step to assure that it uses the Read callback and not the Data callback?



The header comments are pretty explicit here:  kCFSocketReadCallBack, kCFSocketAcceptCallBack, and kCFSocketDataCallBack are mutually exclusive.  You get to pick at most one of these.  In particular, you can't use both kCFSocketReadCallBack and kCFSocketAcceptCallBack (as a glance at the constants should tell you).

Also, it says quite clearly that you should not disable callbacks that your CFSocket does not possess, so don't try to disable kCFSocketDataCallBack if you're not using it.

Douglas Davidson

 _______________________________________________
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: CSocket callback keeps giving my Data instead of Read
      • From: Ken Baer <email@hidden>
References: 
 >CSocket callback keeps giving my Data instead of Read (From: Ken Baer <email@hidden>)

  • Prev by Date: CSocket callback keeps giving my Data instead of Read
  • Next by Date: Re: NSURLConnection: setting Connection: close HTTP header
  • Previous by thread: CSocket callback keeps giving my Data instead of Read
  • Next by thread: Re: CSocket callback keeps giving my Data instead of Read
  • Index(es):
    • Date
    • Thread