Re: Possible problem in fcntl

From: linux-os (Dick Johnson)
Date: Tue Dec 13 2005 - 13:46:17 EST



On Tue, 13 Dec 2005, Filipe Cabecinhas wrote:

> On 12/13/05, linux-os (Dick Johnson) <linux-os@xxxxxxxxxxxx> wrote:
>
>> So what is it that the socket doesn't do, that you expect it
>> should do?
>>
>
> When we call recv on that socket, it returns 0 and sets the string to
> "" (as if the the client had done an orderly shutdown (which is not
> true, since wget says connection refused).
>

How do you know what wget did after the connection was refused?
Didn't it close its socket when returning to the shell?

> We were expecting it to return -1 and set errno to EAGAIN (or to
> return the number of bytes written and set the string to what it
> received).
>

But you said the connection was refused. Wget wouldn't have sent
anything.

> It works as expected if we don't have that (second) fcntl call. But,
> as the accept manpage tells us, in linux the socket returned by accept
> () does not inherit file status flags such as O_NONBLOCK, so we
> think we should call it (to be sure it has that flag). And, even if it
> isn't necessary, we can't tell why it's breaking (because it would
> just be setting a flag (that is already set )).
>

You can always display the results of fcntl(s, F_GETFL) after
changing it to see if it "works".

Did you use setsockopt() to set the socket to SO_BSDCOMPAT if you
are porting or copying BSD code?

> Thanks in advance,
> Filipe Cabecinhas
>

Also, since probably 90% of the Web-Pages accessed on the Internet
are served by Linux servers, it is highly unlikely that Linux is
doing something wrong in its socket code. FYI, there is a seperate
networking list........

Cheers,
Dick Johnson
Penguin : Linux version 2.6.13.4 on an i686 machine (5589.56 BogoMips).
Warning : 98.36% of all statistics are fiction.
.

****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to DeliveryErrors@xxxxxxxxxxxx - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/