Source

core hello world / hello_client.ml

Full commit
Yaron Minsky 5b67326 


Yaron Minsky f9091ca 
Yaron Minsky 59a4baf 
Yaron Minsky f9091ca 



Yaron Minsky 5b67326 
Yaron Minsky 59a4baf 
Yaron Minsky 5b67326 





Yaron Minsky 1866b2a 

Yaron Minsky 5b67326 
Yaron Minsky f9091ca 
Yaron Minsky 5b67326 
open Core.Std
open Async.Std

(* A command that sends the hello request  *)
let say_hello ~host ~port =
  Common.with_rpc_conn (fun conn ->
    Rpc.Rpc.dispatch_exn Hello_protocol.hello_rpc conn "Hello"
    >>| fun response ->
    printf "%s\n%!" response
  )
    ~host ~port

let command =
  Command.async_basic
    ~summary:"Hello World client"
    Command.Spec.(
      empty
      +> Common.port_arg ()
      +> Common.host_arg ()
    )
    (fun port host () -> say_hello ~port ~host)

let () = Command.run command