Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!mintaka!bloom-beacon!eru!hagbard!sunic!dkuug!freja.diku.dk!rimfaxe.diku.dk!thorinn From: thorinn@rimfaxe.diku.dk (Lars Henrik Mathiesen) Newsgroups: comp.unix.internals Subject: Re: question on select() and sockets Message-ID: <1990Nov15.170506.6761@diku.dk> Date: 15 Nov 90 17:05:06 GMT References: Sender: news@diku.dk (The Netnews System) Organization: Department Of Computer Science, University Of Copenhagen Lines: 24 abdik@cat.syr.EDU (Ahmad Dik) writes: >I would like to know if select() can be used to find out if there is >a blocked read on a socket. It can't. And if the other end of the socket is on another machine, I don't see how any system call could help find this info if general. The TCP protocol has no way of getting the info, and things like UDP much less. >If select can not be used to tell if anyone is blocked reading on a >socket, is there any other way I can find out ?? If it's a UNIX-domain socket, you can open /dev/mem, find your own file descriptor for the socket, find the socket, follow its peer link and then go through the process table to find a process that's waiting on the peer socket's receive socket buffer. That's probably the easiest way to do it in general. I suggest that you arrange some other form of cooperation between the processes. If available, semaphores might be what you're looking for. -- Lars Mathiesen, DIKU, U of Copenhagen, Denmark [uunet!]mcsun!diku!thorinn Institute of Datalogy -- we're scientists, not engineers. thorinn@diku.dk