Seeking advice on port "pattern" (long)

Torbjorn Tornkvist <>
Tue Jun 26 09:06:08 CEST 2001


Your program looks fine to me.
Two comments:

 1. You don't have to implement you own timer,
    look at the erlang man page for start_timer/3
    and cancel_timer/1.

 2. You could write your decoder in a continuation
    based style. So instead of having to do the
    append (AllData = Buffered++Data) your decoder
    returns either { Id, Req, Result } , { parseError, Details } ,
    or {needmore, Cont}. When new data arrives, you
    feed it into your continuation ( Cont(Data) ), which
    again will return any of the three possibilities above.

Cheers /Tobbe



More information about the erlang-questions mailing list