Thank you. I am looking into it.

On Thu, Jan 27, 2011 at 5:05 PM,  <o...@okmij.org> wrote:
>
> It seems that the problem is to follow a protocol, reporting protocol
> errors (unexpected responses) and permitting recovery if the
> `supervisor' decided that the error can be fixed by re-reading from
> the server.
>
> This problem -- specifically, communicating with a supervisor
> `out-of-band' and recovery -- is a good use case for delimited
> continuations.
>
> The following code implements the scenario in Magicloud's
> message.
>   http://okmij.org/ftp/continuations/CCmonad/ProtocolRecovery.hs
>
> Actually, the code is interactive, letting the use play a
> good or a bad server. One can see for themselves the effect of
> expected or unexpected responses. The title comments show the examples
> of good or bad interactions. Here is a sample transcript of several
> interactions.
>
>
>
> ProtocolRecovery> main
> Client Connected
> sending: Req_hello
> Enter response, as a number 1..4
> 1
> sending: Req_who_are_you
> Enter response, as a number 1..4
> 2
> Client Dis-connected
>
> ProtocolRecovery> main
> Client Connected
> sending: Req_hello
> Enter response, as a number 1..4
> 1
> sending: Req_who_are_you
> Enter response, as a number 1..4
> 3
> Exception: Err_bad_resp Res_debug
> DEBUG
> Enter response, as a number 1..4
> 3
> Exception: Err_bad_resp Res_debug
> DEBUG
> Enter response, as a number 1..4
> 2
> Client Dis-connected
>
> *ProtocolRecovery> main
> Client Connected
> sending: Req_hello
> Enter response, as a number 1..4
> 1
> sending: Req_who_are_you
> Enter response, as a number 1..4
> 4
> Exception: Err_bad_resp Res_disconnect
> Aborting
> Client Dis-connected
>
> *ProtocolRecovery> main
> Client Connected
> sending: Req_hello
> Enter response, as a number 1..4
> 1
> sending: Req_who_are_you
> Enter response, as a number 1..4
> 1
> Exception: Err_bad_resp Res_hello
> Really bad response!
> Client Dis-connected
>



-- 
竹密岂妨流水过
山高哪阻野云飞

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to