From owner-freebsd-questions Sun Mar 30 10:09:01 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id KAA04161 for questions-outgoing; Sun, 30 Mar 1997 10:09:01 -0800 (PST) Received: (from jmb@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id KAA04154; Sun, 30 Mar 1997 10:08:53 -0800 (PST) From: "Jonathan M. Bresler" Message-Id: <199703301808.KAA04154@freefall.freebsd.org> Subject: Re: Problem with select() To: searle@longacre.demon.co.uk (Michael Searle) Date: Sun, 30 Mar 1997 10:08:53 -0800 (PST) Cc: questions@freebsd.org In-Reply-To: from "Michael Searle" at Mar 30, 97 06:28:57 pm X-Mailer: ELM [version 2.4 PL24] Content-Type: text Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Michael Searle wrote: > > Please could someone point me in the right direction here? As far as I can > see I'm doing as the accept() and select() man pages say, and the same as > the ftp client does. [snip] > serverFd = socket(AF_INET, SOCK_STREAM, DEFAULT_PROTOCOL); what is the value of serverFd? if it is not less and the value of the first argument to the select() below, this will not work. fd_sets are arrays of bit. you set a bit if you want a description checked (setting bit 7 means check descriptor 7). there are 3 fd_sets: read, write, exception conditions. the first arg limits the search of the fd_sets and corresponding descriptors. so a value of 1 means check descriptor 0 only. descriptor 0 is STDIN, unless you have closed STDIN. jmb > FD_ZERO(&sel); > FD_SET(serverFd, &sel); > > if (select(1, &sel, (struct fd_set *) 0, (struct fd_set *) 0, &timezero) == 1) {