Unix Programming - SO_RCVTIMEO

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > December 2006 > SO_RCVTIMEO





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author SO_RCVTIMEO
gio

2006-12-22, 1:17 pm

Hi all, I'm working on a client-server whit posix.
I use setsockopt(...,...., SO_RCVTIMEO,....) ; and for process works
but at thread level doesn't work. Someone can tell me why?
thanks

Maxim Yegorushkin

2006-12-22, 1:17 pm

gio wrote:
> Hi all, I'm working on a client-server whit posix.
> I use setsockopt(...,...., SO_RCVTIMEO,....) ; and for process works
> but at thread level doesn't work.


Do you set this option for each and every socket you'd like to timeout?

> Someone can tell me why?


It could be because socket options apply to that particular socket
which you specify as the first argument in setsockopt() call. Rather
than to a process or a thread.

Rick Jones

2006-12-22, 7:21 pm

Not all "unixes" fully support SO_RCVTIMEO. Some may have that
defined, but it may be a noop.

If you want to make sure that one does not block waiting for data on a
socket, the much more portable way to go is to use either select() or
poll() and a non-blocking socket.

rick jones
--
The glass is neither half-empty nor half-full. The glass has a leak.
The real question is "Can it be patched?"
these opinions are mine, all mine; HP might not want them anyway...
feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com