Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] reading from socket connection
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <xavier.leroy@i...>
Subject: Re: [Caml-list] reading from socket connection
> 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

So, you need to shutdown the connection before attempting to read till EOF.

- Xavier Leroy

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: