Re: Sockets and Network Disconnect?
Re: Sockets and Network Disconnect?
- Subject: Re: Sockets and Network Disconnect?
- From: Eli Bach <email@hidden>
- Date: Thu, 31 Jul 2008 16:19:42 -0700
On Jul 31, 2008, at 4:07 PM, Karl Moskowski wrote:
On 31-Jul-08, at 6:39 PM, Jens Alfke wrote:
On 31 Jul '08, at 2:19 PM, Mark Pauley wrote:
In general, using CFNetwork and NSURL is probably going to be MUCH
easier for you if you want "nice" behavior of this sort. We
already monitor SCNetwork Reachability events and will tell you
well before the 60 second socket timeout.
NSURLConnection doesn't support custom protocols such as Karl says
he's using. Do the lower-level CFNetwork APIs like CFStream check
reachability? I wasn't aware of that.
That's right - I am using a custom protocol, FTP-inspired I'm told.
Because of the somewhat convoluted sequence of packets, plus the
requirement that I pause & restart transfers, managing AsyncSocket's
state between delegate calls just got to be too much.
If you want to get around this, you're going to be rolling your
own asynchronous operation stack anyhow ontop of select...
I don't think it would be quite that bad. But all the blocking
socket/stream calls in SmallSocket would probably need to be
modified so that they could time out.
I re-read the SmallSocket doc, and this is a known limitation:
"There is no way to specify a timeout for connection attempts." Dang.
While SS quite nicely fits in with the NSOperation-based approach, I
was hoping there was a newer synchronous socket wrapper.
Well, you can either read the documentation and search the internet
for code to use the low-level Posix API.
Or you can use the CFNetworking API, which works in both a synchronous
and asynchronous manner. I've only used CFNetwork asynchronously with
a runloop, and I can readily 'simulate' synchronous send/receive using
a local runloop.
_______________________________________________
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