"recv" returning zero bytes

bridged with qdn.public.qnxrtp.devtools
Post Reply
John Nagle

"recv" returning zero bytes

Post by John Nagle » Tue Dec 30, 2003 8:25 am

I occasionally get zero bytes from a "recv" call on a TCP socket.
The socket isn't closed; I can read it again and get more data.
"flags" are set to zero. I'm not making any ioctl calls to set the
socket nonblocking. I'm not using a timer to force the
call to abort. Is this supposed to happen?

John Nagle
Team Overbot

Dean Douthat

Re: "recv" returning zero bytes

Post by Dean Douthat » Thu Jan 01, 2004 12:30 am

Hello:

One possibility is that you are reading too fast for the socket. As an
experiment, you could try inserting a delay.

Regards,

Dean

"John Nagle" <nagle@downside.com> wrote in message
news:bsralf$spk$2@inn.qnx.com...
I occasionally get zero bytes from a "recv" call on a TCP socket.
The socket isn't closed; I can read it again and get more data.
"flags" are set to zero. I'm not making any ioctl calls to set the
socket nonblocking. I'm not using a timer to force the
call to abort. Is this supposed to happen?

John Nagle
Team Overbot

Rennie Allen

Re: "recv" returning zero bytes

Post by Rennie Allen » Thu Jan 01, 2004 10:12 am

John Nagle wrote:
I occasionally get zero bytes from a "recv" call on a TCP socket.
The socket isn't closed; I can read it again and get more data.
"flags" are set to zero. I'm not making any ioctl calls to set the
socket nonblocking. I'm not using a timer to force the
call to abort. Is this supposed to happen?
I don't think that is supposed to happen. Do you have a code fragment
that can reproduce the problem ?

Rennie

Sean Boudreau

Re: "recv" returning zero bytes

Post by Sean Boudreau » Thu Jan 01, 2004 8:30 pm

A return of zero isn't unexpected if the other end has
sent their FIN segment. The non zero after zero doesn't
sound right though. What's the state of the socket as
reported by 'netstat'? Do you have a test case?

-seanb

John Nagle <nagle@downside.com> wrote:
I occasionally get zero bytes from a "recv" call on a TCP socket.
The socket isn't closed; I can read it again and get more data.
"flags" are set to zero. I'm not making any ioctl calls to set the
socket nonblocking. I'm not using a timer to force the
call to abort. Is this supposed to happen?

John Nagle
Team Overbot

John Nagle

Re: "recv" returning zero bytes

Post by John Nagle » Wed Jan 07, 2004 3:26 am

The other end of the connection is a Sealevel Systems 1403
serial to Ethernet converter. I can generate the problem
with that hardware, but don't have time to develop a test
case that doesn't require it.

John Nagle
Team Overbot


Sean Boudreau wrote:
A return of zero isn't unexpected if the other end has
sent their FIN segment. The non zero after zero doesn't
sound right though. What's the state of the socket as
reported by 'netstat'? Do you have a test case?

-seanb

John Nagle <nagle@downside.com> wrote:

I occasionally get zero bytes from a "recv" call on a TCP socket.
The socket isn't closed; I can read it again and get more data.
"flags" are set to zero. I'm not making any ioctl calls to set the
socket nonblocking. I'm not using a timer to force the
call to abort. Is this supposed to happen?


John Nagle
Team Overbot

Post Reply

Return to “qdn.public.qnxrtp.devtools”