[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090924071012.GD28315@1wt.eu>
Date: Thu, 24 Sep 2009 09:10:12 +0200
From: Willy Tarreau <w@....eu>
To: KV Pavuram <kvpavuram@...oo.co.in>
Cc: linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: Socket vs File descriptor
On Wed, Sep 23, 2009 at 11:51:19PM -0700, KV Pavuram wrote:
> Hi,
>
> Is there any ioctl call to determine if a given descriptor is a file descriptor or a socket descriptor.
>
> Similarly, is there a way to find out a socket descriptor type ie.e if it is SOCK_STREAM, or SOCK_DGRAM type.
You should look at getsockopt(), getsockname(), etc... I'm pretty
sure that one of those will offer you exactly what you need. Also,
look at the error codes. Sometimes you can rely on them because you
have different types depending on whether the FD you point to is
not a socket or is a socket of invalid type.
Regards,
Willy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists