• 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: Socket timeout issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Socket timeout issue


  • Subject: Re: Socket timeout issue
  • From: Quinn <email@hidden>
  • Date: Tue, 11 Sep 2007 10:44:03 +0100

At 14:23 -0700 6/9/07, Mitchell Laurren-Ring wrote:
I've already embarked on a series of failed workarounds so I thought it prudent to consult the wisdom here before continuing. Is there an aspect to setting the timeout in this case that I am missing?

I'm not 100% sure, but I believe that you're misunderstanding the role of the socket timeout for sends. The socket timeout affects the how long the socket will wait for space in the socket buffer. This is explained in detail in "TCP/IP Illustrated: Volume 2; The Implementation". On page 496 it says:


    If sosend must wait for space [in the socket buffer, it] waits
    with sbwait until the status of the buffer changes.  [...]

    By default, sbwait blocks until data can be sent.  By changing
    sb_timetimeo in the buffer through the SO_SNDTIMEO socket option,
    the process selects an upper bound fo the wait time.

So, the send timeout is only effective if the socket buffer is full. However, if you have a simple request/response protocol, the socket buffer will never fill up. The send will succeed in placing in the request in the socket buffer. The transport mechanism will start trying to send that data. If the underlying transport is broken, the transport will retry and retry and you'll wait in the receive until the connection tears (which is the very long timeout that you're seeing).

So, if you want to timeout early, you'll need to look at your receive timeout.

Better yet, use one of the SCF techniques described by other folks on this list.

At 9:17 -0400 7/9/07, Peter Sichel wrote:
I asked the SCF to notify me any time an IP address changes using
some Apple supplied sample code (probably written by Quinn).

This is probably one of the samples from TN1145. It's an old 'un but a good 'un.


<http://developer.apple.com/technotes/tn/tn1145.html>

S+E
--
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
_______________________________________________
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


  • Follow-Ups:
    • Re: Socket timeout issue
      • From: Mitchell Laurren-Ring <email@hidden>
References: 
 >Socket timeout issue (From: Mitchell Laurren-Ring <email@hidden>)

  • Prev by Date: Re: NAT-PMP Broadcast Address?
  • Next by Date: Re: Getting SIGHUP in a DO process launched by NSTask
  • Previous by thread: Re: Socket timeout issue
  • Next by thread: Re: Socket timeout issue
  • Index(es):
    • Date
    • Thread