[erlang-questions] Question about gen_tcp:recv

宋寒 theflowerstars@REDACTED
Tue Nov 1 22:10:42 CET 2011


Thanks Andrew, It works well.

Thank you so much. :)

2011/11/1 Andrew Thompson <andrew@REDACTED>

> On Tue, Nov 01, 2011 at 01:15:19PM -0700, flowerstars wrote:
> > Hi guys,
> >
> > I am a beginner of learning erlang. My problem is whenever I call
> > gen_tcp:recv, I got {error, closed} all the time.
> >
> > The procedure is as following:
> >
> > 1> Opts = [list, {packet, 0}, {active, false}, {reuseaddr, true}].
> > [list,{packet,0},{active,false},{reuseaddr,true}]
> > 2> {ok, Sock} = gen_tcp:connect("pop.gmail.com", 995, Opts).
> > {ok,#Port<0.526>}
> > 3> Res = gen_tcp:recv(Sock, 0).
> > {error, closed}
> >
> > Is the problem about my code or about the pop server?
> >
> > Thanks so much for your reply.
> >
>
> 995 is the SSL port for pop3, the server is probably waiting for the SSL
> handshake. If you want this to work, you'll have to use the ssl:connect
> function and friends.
>
> Andrew
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20111101/f71ea4c3/attachment.htm>


More information about the erlang-questions mailing list