This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: How to set a socket to non-blocking?
- From: Jay Foster <jay at systech dot com>
- To: Grant Edwards <grant dot b dot edwards at gmail dot com>
- Cc: ecos-discuss at sources dot redhat dot com
- Date: Fri, 20 Jan 2012 07:28:47 -0800
- Subject: Re: [ECOS] How to set a socket to non-blocking?
- References: <jfbs3q$tl5$1@dough.gmane.org>
- Reply-to: jay at systech dot com
Try
/* Set the socket for non-blocking mode. */
int yes = 1;
if (ioctl(fd, FIONBIO, &yes) < 0)
{
/* Error */
}
Jay
On 1/20/2012 6:01 AM, Grant Edwards wrote:
The eCos reference talks about how sockets behave when their marked as
non-blocking. How does one set a socket to non-blocking?
The following fails with an "unsupported" error:
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK);
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss