Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Mar 1997 10:08:53 -0800 (PST)
From:      "Jonathan M. Bresler" <jmb>
To:        searle@longacre.demon.co.uk (Michael Searle)
Cc:        questions@freebsd.org
Subject:   Re: Problem with select()
Message-ID:  <199703301808.KAA04154@freefall.freebsd.org>
In-Reply-To: <m731106DD@longacre.demon.co.uk> from "Michael Searle" at Mar 30, 97 06:28:57 pm

next in thread | previous in thread | raw e-mail | index | archive | help
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);
> <snip>
> if (select(1, &sel, (struct fd_set *) 0, (struct fd_set *) 0, &timezero) == 1) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199703301808.KAA04154>