🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.transputer
1 messages
1 total messages Started by droux Tue, 04 Aug 1992 11:13
Polling Helios Connected Sockets
#90
Author: droux
Date: Tue, 04 Aug 1992 11:13
40 lines
1959 bytes
We are developing a distributed little system whichs communication 
is based on the  berkeley socket abstraction.
Now we are faced to the following problem:

To poll from a given socket, that means to test if there is some 
data arrived without reading it yet, we use the UNIX system call 
ioctl to set the access mode to the socket and the function recv 
to poll it. 

ioctl allows us to set the socket associated with the descriptor 
to blocking or not blocking, because we offer both possibilies. 
For example:

ioctl(fd, FIONBIO, "\0"); to set the socket blocking or
ioctl(fd, FIONBIO, "\1"); to set it non-blocking, and
recv(fd, buffer, 1, MSG_PEEK) to poll it.

We have developed this method for 4.3BSD (on NeXT) and System V 
(on Sun) and it works fine.

Now we are porting this on a different Unix like operating 
system (Perihelion Helios) which does not provide the ioctl 
system call. A replacement of it is the POSIX fcntl() command. 
This function takes a command and a flag argument to set some 
of the file options. One of these flags is O_NONBLOCK option 
which will cause future calls to recv or read to return 
immediately even there is no data available. 

Our problem is: HOW TO SET THE SOCKET TO
BLOCKING AND NONBLOCKING ?

To set it to nonblocking, we presume that the command would be
fcntl(fd, F_SETFL, O_NONBLOCK);
But what is the reverse operation ?

All suggestions are welcome ! Thank you for your attention.

Daniel Liebhart & Nicolas Droux.
E-mail: droux@hei.unige.ch, University of Geneva, Switzerland.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads