Xref: utzoo comp.lang.c:24437 comp.unix.wizards:19679 comp.unix.questions:18343 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uwm.edu!rutgers!ucsd!helios.ee.lbl.gov!lbl-csam.arpa!antony From: antony@lbl-csam.arpa (Antony A. Courtney) Newsgroups: comp.lang.c,comp.unix.wizards,comp.unix.questions Subject: Re: signals? Message-ID: <4422@helios.ee.lbl.gov> Date: 10 Dec 89 20:50:52 GMT References: <846@usl.usl.edu> <14757@boulder.Colorado.EDU> Sender: usenet@helios.ee.lbl.gov Reply-To: antony@lbl-csam.arpa (Antony A. Courtney) Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 40 X-Local-Date: 10 Dec 89 12:50:52 PST In article <14757@boulder.Colorado.EDU> bri@boulder.Colorado.EDU (Brian Ellis) writes: >In article <846@usl.usl.edu> pcb@usl.usl.edu (Peter C. Bahrs) writes: >>I want to send the server an urgent message from within a client >>application. I want the server to stop what it is doing, handle >>the request and continue (interrupt-ish). >>I think I want to set a signal on incoming socket messages? > > You can arrange to have SIGIO delivered to your server when > a read is possible from a descriptor (your socket). see fcntl(2). > Or you could open up a second socket and use out-of-band stuff. > > -brian ellis (bri@boulder.Colorado.EDU) I don't get the impression that this is really what this guy wants. Maybe I'm reading things wrong, but I get the impression that he has no problem reading stuff off the client when the client has something to write to the server. The issue is how the client can give the server a "kick" of sorts when there is some reason the server is busy doing other things. The best way to do this _IS_ with out-of-band data, but there is no need to set up another socket specifically for that purpose. When the client does a send() with OOB data, the server will get a SIGURG {if it has asked for it}, and will jump to the user-installed signal handler if one exists. This signal handler can then do a recv() off of the socket to get the out-of-band mesage. I don't really feel like going into details--look in the UNIX Programmer's manual supplementary docs, volume 1 for more info. "An Advanced 4.3BSD Interprocess Communication Tutorial", Leffler, et al., Berkeley, CA, USENIX association, 1987. Look in PS1:8-24... Good luck.. antony -- ******************************************************************************* Antony A. Courtney antony@lbl.gov Advanced Development Group ucbvax!lbl-csam.arpa!antony Lawrence Berkeley Laboratory AACourtney@lbl.gov