• 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: Edward Fink <email@hidden>
  • Date: Sat, 7 Sep 2002 00:19:18 -0400

The function(whatToDo) which gets executed when data arrives on the socket....can this also be a method within a class? If so...what would that look like. The reason I ask this is because I am having a problem conceptually figuring out how I would actually be able to make more than one connection via CFSocket if each different socket is going to reference the same function. So if I had a function which was responsible for creating and connecting a CFSocket and the function "whatToDo" which handled the callbacks....how would I differentiate the data arriving? Meaning if I had 3 sockets connected to 3 different servers....and all their data is getting handled by function "whatToDo"...how am I to know what data has just arrived from which server? Will I need to create an array holding all my sockets so I know which server, etc?

Anyways, hopefully I wasn't to confusing in my description but basically I would like to be able to have a class which creates, connects and handles incoming data from my socket. Then I could just instantiate the class to have different sockets being handled separately. However, if the callback cannot reference a class method instead of a regular function I am not sure how I would go about this?

On Friday, September 6, 2002, at 01:06 PM, Douglas Davidson wrote:
am using code like the following which adds the Data callback:
CFSocketRef s = CFSocketCreate(NULL, PF_INET, SOCK_STREAM, IPPROTO_TCP,
kCFSocketDataCallBack, whatToDo, NULL);
Just make that fifth argument (kCFSocketDataCallBack | kCFSocketConnectCallBack).
_______________________________________________
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.

  • Follow-Ups:
    • Re: CFSocket questions
      • From: Douglas Davidson <email@hidden>
References: 
 >Re: CFSocket questions (From: Douglas Davidson <email@hidden>)

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