IPC/socket QUESTION...

Mike "Lakermaniac" Sullivan mike_s at EBay.Sun.COM
Sun Feb 10 12:52:29 AEST 1991


In <26803 at uflorida.cis.ufl.EDU> leh at atlantis.cis.ufl.edu (Les Hill) writes:
>--> The answer is to use fcntl() (or perhaps ioctl() on your machine) and set
>	the socket's descriptor to non-blocking.  Under SunOS4.1.1 I would do
>	either
>		rc = fcntl(socket,F_SETFL,O_NDELAY);
>	or
>		rc = fcntl(socket,F_SETFL,FNDELAY);

>	both of which will do the Right Thing (tm).

Actually, while close to right, I believe the Right Thing is to first read
the flags, then set FNDELAY in addition to the current flags.

	flags = fcntl(socket, F_GETFL, 0);
	fcntl(socket, F_SETFL, flags | FNDELAY);

	Mike
--
Mike Sullivan                     Internet: msullivan at EBay.Sun.COM
Sun Education                     UUCP:     ..!sun!yavin!msullivan
Software Course Developer         Compuserve: 75365,764



More information about the Comp.unix.programmer mailing list