From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA10585; Thu, 15 Feb 2001 15:20:42 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA02843 for ; Thu, 15 Feb 2001 15:20:41 +0100 (MET) Received: from beaune.inria.fr (beaune.inria.fr [128.93.8.3]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f1FEKf101725 for ; Thu, 15 Feb 2001 15:20:41 +0100 (MET) Received: by beaune.inria.fr (8.8.8/1.1.22.3/14Sep99-0328PM) id PAA0000032585; Thu, 15 Feb 2001 15:20:41 +0100 (MET) Date: Thu, 15 Feb 2001 15:20:41 +0100 (MET) From: Damien Doligez Message-Id: <200102151420.PAA0000032585@beaune.inria.fr> To: caml-list@inria.fr Subject: Re: [Caml-list] Re: behaviour of Unix.shutdown_connection Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk >From: Xavier Leroy >Yes. Basically, shutdown_connection just sends an "end of file" >condition to the program connected to the socket on the other side. >The other program can then finish sending what it has to send, then close >its side of the socket. On receiving an "end of file" on your side, >your program knows that the data exchange is over and can (and must) >then close the descriptors on its side. There is only one descriptor, and it is shared between the two channels. Thus if you close both channels, then the descriptor gets closed twice. If it was reopened in-between (for example in a multithreaded program), then some unrelated part of your program will have its descriptor closed under its feet. So you must close the out_channel that was returned by Unix.open_connection, but not the in_channel; and this is true whether you called Unix.shutdown_connection or not. Warning: I have not tested it. -- Damien ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr