Re: Using CFSocket to connect
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.