asynchronous processor for passive clients

  • ssp

    ssp - 2009-04-02

    I want to write multi process service with asynchronous processor for clients whom just creates connection, listen it, and don't send any packets.
    Is following right things to do:
    - set inactivity_timeout to 0 for dynamic workload manager
    - #process sends message and calls when_done
    - from #receive_message i must call process() with descriptors found by container#socket_service#sockets

    or  i misunderstood something?

    • ssp

      ssp - 2009-04-03

      i've coded aforesaid idea and it seem's broken.
      i got next messages in log:
      admin message to contaner: test_msg
      process called
      receive_admin_message: Exception Sys_error("Broken pipe"

      for code:
      class my_hooks =

        method receive_admin_message container name args =
          let s = "admin message to contaner: " ^ name in
          container#log `Info s;
          let aux (proto,fds) =
             (fun fd ->
                container#socket_service#processor#process (fun () -> ())  container fd proto)
             fds in
          List.iter aux container#socket_service#sockets


      class ts_alfa_processor hooks : Netplex_types.processor =

        method process ~when_done container fd proto_name =
          let s = "process called" in
          container#log `Info s;
          let ch = Unix.out_channel_of_descr fd in
          let rec aux () =
            let s = (Sexp.to_string (sexp_of_msg dfl_msg)) ^ "\n" in
            output_string ch s;
            flush ch in
         aux ();

        method supported_ptypes = [ `Multi_processing; `Multi_threading ]

      What is the right way to work with clients whom don't send any packets?


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks