From owner-freebsd-questions Mon Mar 22 6:52:46 1999 Delivered-To: freebsd-questions@freebsd.org Received: from cd.mbn.or.jp (cd.mbn.or.jp [202.217.0.53]) by hub.freebsd.org (Postfix) with ESMTP id 940E715014 for ; Mon, 22 Mar 1999 06:52:34 -0800 (PST) (envelope-from mariga@cd.mbn.or.jp) Received: from gateway (cse4-9.kokubunji.mbn.or.jp [210.144.135.79]) by cd.mbn.or.jp (8.9.1/cd.mbn.or.jp-2.0) with SMTP id XAA12491 for ; Mon, 22 Mar 1999 23:52:10 +0900 (JST) Message-ID: <000501be7472$3bbeb400$064ca8c0@gateway> From: "Masahiro Ariga" To: Subject: how to die gracefully Date: Mon, 22 Mar 1999 23:39:39 +0900 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.72.2106.4 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG My name is Masahiro Ariga, I made a server-like program which receives data from another PC by using socket and,inside,uses pipes and communicates among processes,and send those finished data to client PC using socket . Right now,each process works in the form of infinite loops, and only way to finish the program is to enter Ctl^C. First loaded program works fine,and enters Ctl^C to exit it,but if I execute it second time,it shows abnormalties like taking time to start to send data to clent,and badly enough,it responds not at all. I presume it results from not closing sockets,or residual memory or something,but I'm not sure. So,sinior UNIX programers,would you teach me next two questions ? 1.How should I exit gracefully by pushing Ctl^C. I mean,what should I do to recover normal condition in preparation for next execution ? 2.I like to catch the signal when pushed Ctl^C,and make a handler routine.Would you tell me what signal I can catch when enterring Ctl^C ? My E-mail addres is, mariga@cd.mbn.or.jp To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message