in reply to Re: Detect socket
in thread Detect socket

Thanks, but i was wondering if there any method to check if some number is a socket descriptor, instead of working with range of numbers;

Upd:
Your updated part of post is very good method, thanks, it's very helpful! Would be nice if there are some more methods.

Replies are listed 'Best First'.
Re^3: Detect socket
by ikegami (Patriarch) on Apr 21, 2010 at 21:11 UTC
    There might be, but I don't know it since it's not something one needs to do. Sounds like an XY problem.
Re^3: Detect socket
by ikegami (Patriarch) on Apr 21, 2010 at 21:19 UTC
    huh? My update just checks if socket uses the first available file descriptor. It doesn't check if some number is a socket descriptor. It doesn't even check if some number is any kind of valid file descriptor.
Re^3: Detect socket
by apl (Monsignor) on Apr 22, 2010 at 12:20 UTC
    That's like wondering if a certain address contains a file-descriptor. You might be able to make the determination, but why would you want to?