<div dir="ltr"><div>Hello Per,</div><div><br></div>Could try ... after be what you are looking for? It's not a perfect fit, but I thought I'd mention it as it is a construct that few people seem to know about.<div><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
            Res = try<br>
                      Fun(Data, State)<br>
                  after  -><br>
                          gen_tcp:send(Sock, "done")<br>
                  end,<br></blockquote><div><br></div><div>Lukas </div></div></div></div></div>