How can I know a socket was actually created before using it - Unix
This is a discussion on How can I know a socket was actually created before using it - Unix ; HI,
I'm wondering how I could actually tell if a socket was actually
created in kernel space before calling connect or bind, etc. I know
that the implementations on, say, FreeBSD work and I can trust the
return from socket. ...
-
How can I know a socket was actually created before using it
HI,
I'm wondering how I could actually tell if a socket was actually
created in kernel space before calling connect or bind, etc. I know
that the implementations on, say, FreeBSD work and I can trust the
return from socket. However, what if I were trying to re-implement
the socket call. How would I tell if it were created?
Andy
-
Re: How can I know a socket was actually created before using it
On Nov 13, 12:11 pm, Andrew Falanga wrote:
> I'm wondering how I could actually tell if a socket was actually
> created in kernel space before calling connect or bind, etc. I know
> that the implementations on, say, FreeBSD work and I can trust the
> return from socket. However, what if I were trying to re-implement
> the socket call. How would I tell if it were created?
What is your definition of "created"? How to tell if that has happened
should follow immediately from that. Perhaps a "getsockopt", looking
for EBADFD or ENOTSOCK is what you want?
DS