timeouts on sockets

Hi

How do I set timeouts on TCP sockets (connect(), read(), etc.) in a
multithreaded program?
I can’t use select(), since it is not thread-safe. I can’t use alarm() for
the same reason.

I’m on QNX6.2, GCC.

TIA
Dmitri

Dmitri <someone@somewhere.out-there.com> wrote:

Hi

How do I set timeouts on TCP sockets (connect(), read(), etc.) in a
multithreaded program?
I can’t use select(), since it is not thread-safe. I can’t use alarm() for
the same reason.

You can use select() as long as the fd set is unique to each thread.

chris


Chris McKillop <cdm@qnx.com> “The faster I go, the behinder I get.”
Software Engineer, QSSL – Lewis Carroll –
http://qnx.wox.org/

Hi

How do I set timeouts on TCP sockets (connect(), read(), etc.) in a
multithreaded program?
I can’t use select(), since it is not thread-safe. I can’t use alarm()
for
the same reason.


You can use select() as long as the fd set is unique to each thread.

chris

Thanks, Chris.

What about SO_RCVTIMEO and SO_SNDTIMEO? Do they work on QNX?

Thanks, Chris.

What about SO_RCVTIMEO and SO_SNDTIMEO? Do they work on QNX?

It appears to be, yes.

chris


Chris McKillop <cdm@qnx.com> “The faster I go, the behinder I get.”
Software Engineer, QSSL – Lewis Carroll –
http://qnx.wox.org/

Chris McKillop <cdm@qnx.com> wrote:

Thanks, Chris.

What about SO_RCVTIMEO and SO_SNDTIMEO? Do they work on QNX?


It appears to be, yes.

chris

In 6.2.1.

There’s also TimerTimeout() on _NTO_TIMEOUT_SEND | _NTO_TIMEOUT_REPLY.


-seanb