finding out when connection goes down
finding out when connection goes down
- Subject: finding out when connection goes down
- From: Scott Ribe <email@hidden>
- Date: Sun, 07 Dec 2003 00:00:32 -0700
I've developed a an app which emphasizes good responsiveness over
high-latency connections by handling network communications in background
threads, and I've programmed myself into a corner ;-)
I need to know if the connection to the server has gone down. Right now I
can break the connection, and send at least several new messages without
getting any error. I understand why on the internet it's not possible to
"know" that the connection is down immediately upon sending the message. I
understand that I'm going to have just assume that it's down if I don't get
a response for some fairly arbitrary period of time.
I could time out my own requests. I could add a simple heartbeat request as
well, to try to be more proactive about detecting a network failure. But I'm
also interested to know if there's any way to find out if my last TCP send
has been ACK'd, or alternatively to know if there is any data that's been
sent but never ACK'd.
More details: I'm using OTMPX. One thread (MPTask) takes requests from the
main thread (on an MPQueue), sets up response handlers, and sends the
requests off to the server. Another thread reads incoming requests, and
posts them to the main thread's event queue where they are matched to
response handlers and dealt with.
I just recently (finally, thankfully) managed to drop OS 9 for this app, so
if it would do me any good I could switch to CFNetwork or UNIX-style
sockets. I'd originally been interested in ACE, but the requirement to
support OS 9 blocked that. There's really not much code at all that deals
with the networking--all the application & marshalling & queueing &
messaging logic is independent of the transport, so (not counting OTMP and
MoreOTMP of course) I have just 1 class of 3-4 pages in length that handles
the networking. In other words, I'm thinking of getting rid of OTMP anyway,
even if it doesn't directly help me with this issue ;-)
--
Scott Ribe
email@hidden
http://www.killerbytes.com/
(303) 665-7007 voice
_______________________________________________
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.