public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jay Rogers <jay@rgrs.com>
To: linux-kernel@vger.kernel.org
Subject: PROBLEM: select() says closed socket readable
Date: Fri, 17 Aug 2001 23:28:21 -0400	[thread overview]
Message-ID: <E15Xwmb-0007eJ-00@shell2.shore.net> (raw)

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_ZERO(&rfds);
        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);
    
        exit(0);
    } /* 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
binutils               2.10.91.0.2
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

             reply	other threads:[~2001-08-18  3:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-18  3:28 Jay Rogers [this message]
2001-08-18 16:27 ` PROBLEM: select() says closed socket readable kuznet
2001-08-18 22:52   ` Ton Hospel
2001-08-20 14:34   ` Jay Rogers
2001-08-20 15:03     ` David S. Miller
2001-08-20 15:29       ` Udo A. Steinberg
2001-08-21  9:02       ` Mike Jagdis
2001-08-21 17:35         ` David Schwartz
2001-08-21 18:38           ` Alan Cox
2001-08-21 19:01             ` David Schwartz
2001-08-22  9:26           ` Mike Jagdis
2001-08-22 21:40             ` David Schwartz
2001-08-23 10:30               ` Mike Jagdis
2001-08-23 10:56               ` [PATCH] " Mike Jagdis
2001-08-20 19:48     ` PROBLEM: " David Schwartz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E15Xwmb-0007eJ-00@shell2.shore.net \
    --to=jay@rgrs.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox