Quantcast

Question about gen_tcp:recv

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Question about gen_tcp:recv

flowerstars
This post has NOT been accepted by the mailing list yet.
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.
Loading...