On Thu, May 27, 2004 at 07:25:10PM +1000, Erik de Castro Lopo wrote:
> I'm not sure fcntl() works on sockets, I thought you had to use an ioctl().
fcntl() does work on sockets. I've used it.
> > int fileDescriptor = socket(AF_INET, SOCK_STREAM, 0);
> > if ( 0 > fileDescriptor )
> > printf("Unable to obtain new socket (errn = %d, text = \"%s\"\n",
> > errno, strerror(errno));
>
> Errrm, all you have is a socket, its not connected to anything. Maybe you
> could connect() or accept() on the socket before you set it to non-blocking.
I was going to wait until I got home before I answered the original
post (my Unix Network Programming books are at home), but I think
you've found the answer. From fcntl(2):
EBADF fd is not an open file descriptor, or the command
was F_SETLK or F_SETLKW and the file descriptor
open mode doesn't match with the type of lock
requested.
> --
> +-----------------------------------------------------------+
> Erik de Castro Lopo [EMAIL PROTECTED] (Yes it's valid)
> +-----------------------------------------------------------+
> A good debugger is no substitue for a good test suite.
> --
> --
> +-----------------------------------------------------------+
> Erik de Castro Lopo [EMAIL PROTECTED] (Yes it's valid)
> +-----------------------------------------------------------+
> A good debugger is no substitue for a good test suite.
CChheeeerrss,,
JJoohhnn
--
Trying to do *anything* industrial-strength on a NT platform is doomed to
failure - it's like the realisation that you've been allocated a bunk-space
below a confirmed bedwetter. The question is not whether you are going to
get pissed on, but when. -- Tanuki
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html