Socket rx timeout

Hello,

I have a big problem working with sockets.
I’m not able to manage correctly the RX timeout.
This is the code I wrote (client side of course):

const long RX_TIMEOUT=3;
t.tv_sec=RX_TIMEOUT;
t.tv_usec=0;
setsockopt(activeSock,SOL_SOCKET,SO_RCVTIMEO, &t ,sizeof(t));
nByte=read(socket, rxMsg, 1);

It’s very simple but if the server doesn’t send any char to this client the
process stays blocked on the read function forever.
I think that the TIMEOUT doesn’t work correctly, but I hope I wrong !!!
The function setsockopt doesn’t return any error code (it seems to work
correctly).
I’ve been testing the same code with LINUX and it works correctly (the read
function exit correctly and nByte = 0… as I expected). The same code works
correctly with QNX4.

Now I’m using Momentics Non Commercial Edition.

Thanks in advance
Tonio

This was fixed around July of 2002 and should be
in the latest release of 6.2.1.

-seanb

Tonio <toniop@libero.it> wrote:

Hello,

I have a big problem working with sockets.
I’m not able to manage correctly the RX timeout.
This is the code I wrote (client side of course):

const long RX_TIMEOUT=3;
t.tv_sec=RX_TIMEOUT;
t.tv_usec=0;
setsockopt(activeSock,SOL_SOCKET,SO_RCVTIMEO, &t ,sizeof(t));
nByte=read(socket, rxMsg, 1);

It’s very simple but if the server doesn’t send any char to this client the
process stays blocked on the read function forever.
I think that the TIMEOUT doesn’t work correctly, but I hope I wrong !!!
The function setsockopt doesn’t return any error code (it seems to work
correctly).
I’ve been testing the same code with LINUX and it works correctly (the read
function exit correctly and nByte = 0… as I expected). The same code works
correctly with QNX4.

Now I’m using Momentics Non Commercial Edition.

Thanks in advance
Tonio

Thank you.
bye
Tonio


“Sean Boudreau” <seanb@qnx.com> wrote in message
news:bsp936$oq$1@nntp.qnx.com

This was fixed around July of 2002 and should be
in the latest release of 6.2.1.

-seanb

Tonio <> toniop@libero.it> > wrote:
Hello,

I have a big problem working with sockets.
I’m not able to manage correctly the RX timeout.
This is the code I wrote (client side of course):

const long RX_TIMEOUT=3;
t.tv_sec=RX_TIMEOUT;
t.tv_usec=0;
setsockopt(activeSock,SOL_SOCKET,SO_RCVTIMEO, &t ,sizeof(t));
nByte=read(socket, rxMsg, 1);

It’s very simple but if the server doesn’t send any char to this client
the
process stays blocked on the read function forever.
I think that the TIMEOUT doesn’t work correctly, but I hope I wrong !!!
The function setsockopt doesn’t return any error code (it seems to work
correctly).
I’ve been testing the same code with LINUX and it works correctly (the
read
function exit correctly and nByte = 0… as I expected). The same code
works
correctly with QNX4.

Now I’m using Momentics Non Commercial Edition.

Thanks in advance
Tonio