Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Long timeouts to real sites with no MQTT

On Tue, Feb 26, 2013 at 9:47 AM, Nicholas O'Leary <nick.oleary@xxxxxxxxx> wrote:

> nol@noltop:~$ time telnet some.company.net 1883

I got the below on Ubuntu Linux.

telnet: Unable to connect to remote host: Connection timed out

real    1m3.235s
user    0m0.000s
sys     0m0.008s

This can be controlled on a computer wide basis with
/proc/sys/net/ipv4/tcp_syn_retries - setting to "2" gave me a timeout
of about 7 seconds. This does affect other applications of course.

The suggestions I've just seen for C code is to set the socket
non-blocking before a connect(), then use select() or similar to wait
for the connection with a timeout. I'll be looking at that for my own
code!

Cheers,

Roger


Back to the top