is it a socket or is it not?

SANDEEP at S63.Prime.COM SANDEEP at S63.Prime.COM
Tue Aug 1 03:44:00 AEST 1989


generous at 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 at s63.prime.com

Above opinions are not those of Prime Computer.



More information about the Comp.unix.wizards mailing list