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

Re: Using CFSocket to connect


  • Subject: Re: Using CFSocket to connect
  • From: Becky Willrich <email@hidden>
  • Date: Tue, 2 Jul 2002 11:50:48 -0700

This is the part I'm confused about. If I have a timeout of say 5 seconds,
then the connect callback WILL be called in 5 seconds, whether the connect
succeeded or failed, right? If I can count on getting this callback, why do
I need to create ANOTHER timer to detect when I ran into the timeout?

No - if you set the timeout to 5 seconds, CFSocketConnectToAddress() will not return for up to 5 seconds; you will not get back to the run loop at all. It's the same as if you started the connect, then sat in select() with a 5 second timeout.

With background connection now as an option to me, I could actually try to
connect to all servers in the list simultaneously, use the first one that
succeeds, and then disconnect any others that happen to get connections.
This could be a bit resource intensive on the server, but it would allow for
the quickest possible connect on the client side.

That's resource intensive on the machine trying to make the connection, all the servers you're trying to contact, and the routers inbetween - that's a lot of traffic.... If you flood a router, or if you keep the client busy just sending out all those connect requests, you might well delay receiving the first connect response, in which case it's not faster than if you tried the connects serially. A lot depends on the number of servers you're trying to contact, and the networking configuration between them and the client; tests will tell you what the best approach is.

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.

  • Follow-Ups:
    • Re: Using CFSocket to connect
      • From: Mike Laster <email@hidden>
References: 
 >Re: Using CFSocket to connect (From: Mike Laster <email@hidden>)

  • Prev by Date: Re: Using CFSocket to connect
  • Next by Date: Re: Using CFSocket to connect
  • Previous by thread: Re: Using CFSocket to connect
  • Next by thread: Re: Using CFSocket to connect
  • Index(es):
    • Date
    • Thread