Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!umich!yale!cs.utexas.edu!rutgers!rochester!rit!ultb!cep4478 From: cep4478@ultb.isc.rit.edu (C.E. Piggott) Newsgroups: comp.unix.wizards Subject: Re: Sockets input and output Message-ID: <2093@ultb.isc.rit.edu> Date: 4 Feb 90 07:48:08 GMT References: <583@uncw.UUCP> Reply-To: cep4478@ultb.isc.rit.edu (C.E. Piggott) Organization: Information Systems and Computing @ RIT, Rochester, New York Lines: 35 I'm not sure if this is what you want or not ... but if by "the sockets buffering" you mean that the read() on the socket blocks if there is no data ready to be processed, then there are ways around that: one would be to do the fcntl() to make the socket NON-BLOCKING; then, the read would fail with errno==EWOULDBLK (or something like that - look it up). This, however, would produce a spinlock as you check for data - not too effecient. A better approach would be to use select() to look at a bunch of file descriptors - in your example, say, three remote sockets which may have data ready to be read, and the keyboard. BEWARE that most machines I've tried have seem to have had one problem or another with select() - for starters, documentation claims that select() returns an EXCEPTION condition on a socket if that socket has terminated (fine print indicates that the only exception that is supported under Ultrix-32, SUN-OS, and Unix 4.3 is out-of-band data). The third approach is to make the whole thing interrupt driven with a handler for a SIGIO, generated when data is ready...however, for the # of sockets you want to have open at once, you'd have the same problem all over again trying to figure out which one it is. Other than that, sockets shouldn't "buffer" past the normal time it holds on to data before it can get squeezed out the other end...as soon as the sockets are osculate, if you write one byte to it, one byte should immediately (relative term) pop out. Chris N2JGW -- -- Christopher E. Piggott, N2JGW cep4478@ultb.isc.rit.edu President n2jgw@n2jgw.ampr [44.69.2.1] Rochester Institute of Technology N2JGW @ WB2WXQ Amateur Radio Club K2GXT CEP4478@RITVAXA.BITNET