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 RAA07188; Mon, 5 May 2003 17:19:40 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA07728 for ; Mon, 5 May 2003 17:19:39 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h45FJbH12522; Mon, 5 May 2003 17:19:37 +0200 (MET DST) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA07481; Mon, 5 May 2003 17:19:37 +0200 (MET DST) Date: Mon, 5 May 2003 17:19:37 +0200 From: Xavier Leroy To: Christian.Schaller@siemens.com Cc: caml-list@inria.fr Subject: Re: [Caml-list] reading from socket connection Message-ID: <20030505171937.B7282@pauillac.inria.fr> References: <4F8477CFC03A71499AD8DDA428F5E114037D19@neptun.cert.siemens.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <4F8477CFC03A71499AD8DDA428F5E114037D19@neptun.cert.siemens.de>; from Christian.Schaller@siemens.com on Mon, Apr 28, 2003 at 09:09:20PM +0200 X-Spam: no; 0.00; caml-list:01 nntp:01 ocaml:01 eof:02 unix:02 library:03 hint:04 output:05 hints:06 manual:07 function:09 shutdown:09 U4:88 leroy:12 tells:13 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > When connecting, let's say to a nntp server and just exchanging some > information, the OCaml manual tells me to use open_connection from the Unix > library. This works well, however, how can I read the output from the > remote server? My first try was a readLines function (see below) to read > until EOF, however there's no EOF, thus my program hanging. Any > hints? One hint: most servers, including NNTP servers, wait until the client shuts down its half of the network connection before they shut down their half of the connection, thus giving an EOF condition to the client. So, you need to shutdown the connection before attempting to read till EOF. - Xavier Leroy ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners