Home > The Specified > The Specified File Descriptor Is Not A Socket

The Specified File Descriptor Is Not A Socket

Note that the timeout interval will be rounded up to the system clock granularity, and kernel scheduling delays mean that the blocking interval may overrun by a small amount. All rights reserved.Unauthorized reproduction or linking forbidden without expressed written permission. Which was the last major war in which horse mounted cavalry actually participated in active fighting? Portable programs may wish to check for EAGAIN and loop, just as with EINTR. navigate here

The Linux pselect6() system call modifies its timeout argument. share|improve this answer answered Nov 25 '12 at 13:22 jim mcnamara 12k21637 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. ERRORS top EBADF An invalid file descriptor was given in one of the sets. (Perhaps a file descriptor that was already closed, or one on which an

In the traditional implementation of Unix, file descriptors index into a per-process file descriptor table maintained by the kernel, that in turn indexes into a system-wide table of files opened by Three independent sets of file descriptors are watched. FUTURE DIRECTIONS None. A Unix process' file descriptor table is an example of a C-list.

If the listen queue is empty of connection requests and O_NONBLOCK is not set on the file descriptor for the socket, accept() shall block until a connection is present. The request cannot be fulfilled by the server Login with LinkedIN Or Log In Locally Email Password Remember Me Forgot Password?Register Eng-Tips Forums Tek-Tips Forums Search Posts Find So, lets say I have 10 threads. Four macros are provided to manipulate the sets.

The POSIX.1 situation is that one should include for select() and pselect(). The restrict keyword is added to the accept() prototype for alignment with the ISO/IEC9899:1999 standard. On some UNIX systems, select() unblocks and returns, with an indication that the file descriptor is ready (a subsequent I/O operation will likely fail with an error, unless another the file End of informative text.

The following sections are informative. This table records the mode with which the file (or other resource) has been opened: for reading, writing, appending, reading and writing, and possibly other modes. There may be other circumstances in which a file descriptor is spuriously reported as ready. Voila, race condition. –nc3b Apr 18 '11 at 18:07 @nc3b - argh, I haven't thought about that..

So, I can't avoid race conditions, I could just reduce the probability for them, right? –Kiril Kirov Apr 19 '11 at 6:58 Parsing tcp (under /proc) for any purpose Those listed in readfds will be watched to see if characters become available for reading (more precisely, to see if a read will not block; in particular, a file descriptor is Then a test of this global flag followed by a call of select() could hang indefinitely if the signal arrived just after the test but just before the call. And what is the difference between "connected" and "not a valid descriptor" ENOTCONN The specified socket is not connected.

Did Jack die at the end from a shotgun wound? asked 5 years ago viewed 1785 times active 4 years ago Linked 138 Is it safe to parse a /proc/ file? 3 Check Socket File Descriptor is Available? close() closefrom() (BSD and Solaris only; deletes all file descriptors greater than or equal to specified number) dup() (duplicates an existing file descriptor guaranteeing to be the lowest number available file sigmask is a pointer to a signal mask (see sigprocmask(2)); if it is not NULL, then pselect() first replaces the current signal mask by the one pointed to by sigmask, then

Under glibc 2.1 to 2.2.1, it gives pselect() when _GNU_SOURCE is defined. So you must protect it. –David Schwartz Aug 14 '11 at 19:42 add a comment| up vote 1 down vote Checking the errno is by far your best option. The system returned: (22) Invalid argument The remote host or network may be down. his comment is here CONFORMING TO top select() conforms to POSIX.1-2001, POSIX.1-2008, and 4.4BSD (select() first appeared in 4.2BSD).

Multithreaded applications If a file descriptor being monitored by select() is closed in another thread, the result is unspecified. Thanks for the suggestion though. Note, however, that what is actually passed is a reference to an "open file description" that has mutable state (the file offset, and the file status and access flags).

Remove advertisements Sponsored Links Perderabo View Public Profile Find all posts by Perderabo #5 02-15-2007 ONEX Registered User Join Date: Feb 2007 Last Activity: 3 May 2007, 3:39

Close this window and log in. The pselect() interface described in this page is implemented by glibc. pselect() is defined in POSIX.1g, and in POSIX.1-2001 and POSIX.1-2008. Note that multiple file descriptors can refer to the same file table entry (e.g., as a result of the dup system call)[3]:104 and that multiple file table entries can in turn

The time now is 04:25 AM. - Contact Us - UNIX & Linux - unix commands, linux commands, linux server, linux ubuntu, shell script, linux distros. - Advertising - Top If the path parameter is not NULL, it is checked whether the file descriptor is bound to the specified file name. Otherwise, -1 shall be returned and errno set to indicate the error. Already a member?

On Linux (and some other systems), closing the file descriptor in another thread has no effect on select().