[lkml]   [2001]   [Aug]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectPROBLEM: select() says closed socket readable
For linux 2.4.2, select() indicates socket ready for read on a
socket that's never been connected. This is inconsistent with
other versions of Unix including Linux 2.2.

The following program demonstrates:

#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>

main(int argc, char *argv[])
fd_set rfds;
int retval;
int sock;
struct timeval tv;

sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock == -1) abort();

FD_SET(sock, &rfds);
tv.tv_sec = 0;
tv.tv_usec = 0;

retval = select(sock + 1, &rfds, NULL, NULL, &tv);
printf("retval from select(): %d\n", retval);

} /* end main program */

Output from "ver_linux" follows:

Linux costarica 2.4.2-2 #1 Sun Apr 8 20:41:30 EDT 2001 i686 unknown

Gnu C 2.96
Gnu make 3.79.1
util-linux 2.10r
modutils 2.4.2
e2fsprogs 1.19
reiserfsprogs 3.x.0f
pcmcia-cs 3.1.22
PPP 2.4.0
Linux C Library 2.2.2
Dynamic linker (ldd) 2.2.2
Procps 2.0.7
Net-tools 1.57
Console-tools 0.3.3
Sh-utils 2.0
Modules Loaded nfs lockd sunrpc nls_iso8859-1 ide-cd cdrom autofs 3c59x ipchains usb-uhci usbcore
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:57    [W:0.073 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site