Hi Alek,
The fcntl way may be better done like below, as the original flags get
saved.
Regards, Stuart.
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
int non_block(int fd)
{
int flags;
if( (flags = fcntl(fd, F_GETFL)) < 0 ) {
return -1;
}
if( fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0 ) {
return -1;
}
return 0;
}
Aleksandar Bakic wrote:
>
> "Michael Frank" <[EMAIL PROTECTED]> writes:
>
> > The right option to make socket non-blocking one is
> >
> > fcntl(fd, F_SETFL, O_NONBLOCK)
>
> Hm... I actually used this in one application long time ago, but
> removed it because it behaved strangely. (Could be just that some data
> were lost due to lack of buffer space; the TCP_NODELAY seemed better,
> although I can't remember exactly what it does.)
>
> Thanks,
> Aleks
--- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
----
For more information on Real-Time Linux see:
http://www.rtlinux.org/~rtlinux/
- Re: [rtl] Networking With RT-Linux David Schleef
- Re: [rtl] Networking With RT-Linux Aleksandar Bakic
- Re: [rtl] Networking With RT-Linux David Schleef
- Re: [rtl] Networking With RT-Linux Aleksandar Bakic
- Re: [rtl] Networking With RT-Linux David Schleef
- Re: [rtl] Networking With RT-Linux Paul Koning
- Re: [rtl] Networking With RT-Linux Yusuf Motiwala
- Re: [rtl] Networking With RT-Linux Aleksandar Bakic
- RE: [rtl] Networking With RT-Linux Michael Frank
- Re: [rtl] Networking With RT-Linux Aleksandar Bakic
- Re: [rtl] Networking With RT-Linux Stuart Hughes
- Re: [rtl] Networking With RT-Linux Aleksandar Bakic
- RE: [rtl] Networking With RT-Linux Michael Frank
- Re: [rtl] Networking With RT-Linux, 139... Peter Lindener
- Re: [rtl] Networking With RT-Linux Kulwinder Atwal
- Re: [rtl] Networking With RT-Linux Tomasz Motylewski
- Re: [rtl] Networking With RT-Linux Yusuf Motiwala
- Re: [rtl] Networking With RT-Linux yodaiken
- Re: [rtl] Networking With RT-Linux Aleksandar Bakic
- Re: [rtl] Networking With RT-Linux yodaiken
- Re: [rtl] Networking With RT-Linux Paul Koning
