RE: Time out a connect() call
RE: Time out a connect() call
- Subject: RE: Time out a connect() call
- From: Satish Kilaru <email@hidden>
- Date: Mon, 21 Nov 2011 15:59:16 -0500
- Acceptlanguage: en-US
- Thread-topic: Time out a connect() call
Use select() before calling recvfrom().
________________________________________
From: macnetworkprog-bounces+skilaru=email@hidden [macnetworkprog-bounces+skilaru=email@hidden] On Behalf Of Nathan Sims [email@hidden]
Sent: Monday, November 21, 2011 3:27 PM
To: Mac Network Programming
Subject: Re: Time out a connect() call
> On Feb 28, 2011, at 3:28 PM, Vincent Lubet wrote:
>>
>> On Feb 28, 2011, at 3:18 PM, Nathan Sims wrote:
>>>
>>> On Feb 28, 2011, at 1:19 PM, Josh Graessley wrote:
>>>
>>>> There is a socket option that will let you adjust the TCP connection timeout. Changing the timeout does not address the issue that 5 seconds can feel like an eternity, and any timeout short enough to not feel like an eternity is unlikely to be long enough to satisfy every situation.
>>>
>>> Do you mean socket option SO_RCVTIMEO or is there one specifically for connect()? The reason I'm wanting to set it down so low is because it's for use on a dedicated intranet, and the destination is either there or it's not, so 5 to 10 seconds is generous in this case.
>>
>> No, Josh was referring to TCP_CONNECTIONTIMEOUT from <netinet/tcp.h>
The above works great on TCP sockets. Now I have a socket(AF_UNIX, SOCK_DGRAM, 0) and want to specify a timeout value on a recvfrom() call to that socket. I can't find a UDP equivalent to TCP_CONNECTIONTIMEOUT. How can I time out the recvfrom() call?
_______________________________________________
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
******************Legal Disclaimer***************************
"This communication may contain confidential and privileged
material for the sole use of the intended recipient. Any
unauthorized review, use or distribution by others is strictly
prohibited. If you have received the message in error, please
advise the sender by reply email and delete the message. Thank
you."
*********************************************************
_______________________________________________
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