All of lore.kernel.org
 help / color / mirror / Atom feed
From: Willy Tarreau <w@1wt.eu>
To: KV Pavuram <kvpavuram@yahoo.co.in>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: Socket vs File descriptor
Date: Thu, 24 Sep 2009 09:10:12 +0200	[thread overview]
Message-ID: <20090924071012.GD28315@1wt.eu> (raw)
In-Reply-To: <179773.9311.qm@web8404.mail.in.yahoo.com>

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


  reply	other threads:[~2009-09-24  7:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-24  6:51 Socket vs File descriptor KV Pavuram
2009-09-24  7:10 ` Willy Tarreau [this message]
2009-09-24  7:54 ` "YOSHIFUJI Hideaki (吉藤 英明)"

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090924071012.GD28315@1wt.eu \
    --to=w@1wt.eu \
    --cc=kvpavuram@yahoo.co.in \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.