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] The Makefile
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Vasili Galchin <vasiliocaml@y...>
Subject: [Caml-list] Test case syntax error

   I have added some functionality to the OCaml
run-time library and I am trying to test. I wrote test
case below that refuses to complile.

1) It gets a syntax error on the ending "done" for the
"while true". I have tried trimming down and still the
syntax error. I am sorry for something so elementary.
Can anyone help?

2) I am running on Linux. I did a "man ocamlc" to see
what kind of compiler switches there are. Is there a
compiler switch that gives a more verbose/helpful
error than simply "syntax error"?

Regards, vasili

----------------------------test case-----------------

(* The multicast listener *)
let listen ((my_addr_octet:string),
(multicast_addr_octet:string), multicast_port) =
    let descr = Unix.socket Unix.PF_INET
            (* Convert IP octet strings to IP addrs *)
            let my_addr = Unix.inet_addr_of_string
                multicast_addr =
Unix.inet_addr_of_string multicast_addr_octet in
            (* Open a UDP socket *)
            let sockaddr = Unix.ADDR_INET(my_addr,
               (* Bind the sock addr *)
               Unix.bind descr sockaddr;
               (* Set TTL for ipv4 *)
               (* TBD!!! *)
               (* Join the multicast group *)
               Unix.multicast_join descr my_addr

               (* Read loop *)
               while true do
                  let (buffer:string) = "" in
                     (* Do blocking read! *)
                     let (x, y) = Unix.recvfrom descr
buffer 0 128 [MSG_OOB]
             _ -> Printf.printf "%s\n" "blah";;     
listen ("", "", 12345);;

Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster

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