Version française
Home     About     Download     Resources     Contact us    
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
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