[erlang-questions] gen_tcp recv web content

月忧茗 <>
Thu Mar 28 09:16:34 CET 2013


Hi,

I'm learning Erlang, And I have some code, to get web site content.

http://pastebin.com/BDeUuymX


in erlang shell:


c(test).
test:start("www.yahoo.com", 80).

I MUST waiting for the remote website close the socket,
after that,  I got {tcp_closed, Socket} msg,
then finish the loop.

But,  Waiting for remote close socket was takes a 'long' time,

Is there any way to know, i have already get the whole data, and close the
socket by myself?


using Content-Length?  How?


another question:

test:start("github.com", 443).

when play with such this 'https' sites,  the code can not working.
It seems like being blocked.  can not receive the data, and finally closed
by remote sites.


Thanks.











-- 
My GitHub
https://github.com/yueyoum

My Blog
http://codeshift.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130328/8ecf8a4c/attachment.html>


More information about the erlang-questions mailing list