Mailinglist Archive: opensuse-programming (33 mails)
| < Previous | Next > |
Re: [suse-programming-e] EAGAIN on a blocking socket?
- From: Anders Johansson <andjoh@xxxxxxxxxx>
- Date: Thu, 02 Mar 2006 21:03:00 +0100
- Message-id: <44074F74.8020001@xxxxxxxxxx>
Per Jessen wrote:
> Anders Johansson wrote:
>
>> No, see "man dup". The file status flags are shared between the two,
>> so a change to one means both are affected. The file descriptor flags
>> are not.
>
> Hmm. Any suggestion on how to do nonblocking reads and blokcing writes
> on one socket?
>
>> At what point do you do the GET_FL? I don't see it in the code you
>> sent
>
> I think I removed it again. I basically did a check just before
> fputs().
> Something like this:
>
> fcntl( fd, F_GETFL, &flag );
> if ( flag & O_NONBLOCK ) log_error("nonblocking when it shudnt be");
by the way, this isn't a valid call. flag doesn't get modified by this.
Correct would be
flag=fcntl(fd, F_GETFL);
> Anders Johansson wrote:
>
>> No, see "man dup". The file status flags are shared between the two,
>> so a change to one means both are affected. The file descriptor flags
>> are not.
>
> Hmm. Any suggestion on how to do nonblocking reads and blokcing writes
> on one socket?
>
>> At what point do you do the GET_FL? I don't see it in the code you
>> sent
>
> I think I removed it again. I basically did a check just before
> fputs().
> Something like this:
>
> fcntl( fd, F_GETFL, &flag );
> if ( flag & O_NONBLOCK ) log_error("nonblocking when it shudnt be");
by the way, this isn't a valid call. flag doesn't get modified by this.
Correct would be
flag=fcntl(fd, F_GETFL);
| < Previous | Next > |