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. ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: How can I know a socket was actually created before using it

  1. 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


  2. 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


+ Reply to Thread