[erlang-questions] R14B gen_tcp:recv/2,3

Bengt Kleberg bengt.kleberg@REDACTED
Fri Sep 17 07:38:01 CEST 2010


Greetings,

If (I have not read the document) gen_tcp:recv/2,3 returns {ok,
{http_error,String}} your have a matching clause. Unfortunately the
match means that Bin will be {http_error,String}, which is probably not
what you want.


bengt

 On Fri, 2010-09-17 at 01:08 +0200, Roberto Ostinelli wrote:
> dear list,
> 
> i read from R14B release's readme:
> http://erlang.org/download/otp_src_R14B.readme
> 
> OTP-8831  For a socket in the HTTP packet mode, the return value from
> gen_tcp:recv/2,3 if there is an error in the header will be
> {ok,{http_error,String}} instead of {error,{http_error,String}} to be
> consistent with ssl:recv/2,3.
> 
> i'm not really sure i did understand well: does this mean that all
> code which relies on gen_tcp:recv/2,3 needs to be rewritten? for
> instance, will this code generate a no matching clause in R14B in case
> an error is produced?
> 
> case gen_tcp:recv(Sock, Len, RecvTimeout) of
>     {ok, Bin} -> {ok, Bin};
>     {error, Reason} -> {error, Reason}
> end.
> 
> i, for one, surely hope i've misinterpreted this statement..
> 
> r.
> 
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
> 



More information about the erlang-questions mailing list