Return-Path: william@bourbon.usc.edu Delivery-Date: Sat Sep 6 19:07:19 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3 Received: from bourbon.usc.edu (bourbon.usc.edu [128.125.9.75]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id m8727JwK028293 for ; Sat, 6 Sep 2008 19:07:19 -0700 Received: from bourbon.usc.edu (localhost.localdomain [127.0.0.1]) by bourbon.usc.edu (8.14.2/8.14.1) with ESMTP id m8725uuT030247 for ; Sat, 6 Sep 2008 19:05:56 -0700 Message-Id: <200809070205.m8725uuT030247@bourbon.usc.edu> To: cs551@merlot.usc.edu Subject: Re: cs 551 Date: Sat, 06 Sep 2008 19:05:56 -0700 From: Bill Cheng Someone wrote: > When the server shuts down, and if a client is still being processed, it > just closes the master socket (listening socket) and waits for the thread to > finish. At this point a new client cannot make a request. I assume this is > the correct approach. You should ask the child thread to terminate as soon as possible! > I have another question regarding SIGPIPES. I'm using a handler to handle > sigpipes at the server. So even if a client gets a ctrl^c and stops, the > server should just terminate its corresponding thread. But somehow it just > handles one such sigpipe. if i have 3 clients, the first one quits and the > signal is handled correctly. but when the second one quits, the whole server > process quits with a broken pipe error. > > I read somewhere that a signal handler does its job only once This is true for some OS. I don't know if it is true for Solaris. I think I've also read somewhere that System V machines, you need to do this, but I could be wrong. (Also, I'm not sure if Solaris is a System V machine.) > and so i tried > calling the handler within itself , like this > > void myhandler(int signum) > { /**** does all the clean up ***/ > signal(SIGPIPE,myhandler); > } > > Even this does not work. Can you give a hint as to how this can be achieved? Strange... I'm not sure why this is happening for you. Sorry! -- Bill Cheng // bill.cheng@usc.edu