Socket rx timeout

bridged with qdn.public.ddk.network
Post Reply
Tonio

Socket rx timeout

Post by Tonio » Mon Dec 29, 2003 7:11 pm

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

Sean Boudreau

Re: Socket rx timeout

Post by Sean Boudreau » Mon Dec 29, 2003 7:11 pm

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

Tonio

Re: Socket rx timeout

Post by Tonio » Tue Jan 06, 2004 6:58 pm

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

Post Reply

Return to “qdn.public.ddk.network”