Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!cica!tut.cis.ohio-state.edu!bloom-beacon!primerd!ENI!S63!SANDEEP From: SANDEEP@S63.Prime.COM Newsgroups: comp.unix.wizards Subject: Re: is it a socket or is it not? Message-ID: <387000001@S63.Prime.COM> Date: 31 Jul 89 17:44:00 GMT References: <8@dgis.daitc.mil> Lines: 19 Nf-ID: #R:dgis.daitc.mil:-800:S63:387000001:000:570 Nf-From: S63.Prime.COM!SANDEEP Jul 31 17:44:00 1989 generous@dgis.UUCP writes : >What's a good method of determining whether a file descriptor >is a socket or not? The fstat(2) call does not work well on sockets If you want the name of the socket also, try if (getsockname(s,&..,&..) < 0) { if (errno == ENOTSOCK) { /* Is not a socket */ } } -------------------------------------------------------------------------- In_Real_Life : Sandeep Srivastava Prime Computer, Natick, MA. Phone : 508-879-2960 x3711 Internet:sandeep@s63.prime.com Above opinions are not those of Prime Computer.