How to write a simple webserver in Erlang?

前端 未结 6 752
伪装坚强ぢ
伪装坚强ぢ 2020-12-07 12:20

Using the default Erlang installation what is the minimum code needed to produce a \"Hello world\" producing web server?

6条回答
  •  孤城傲影
    2020-12-07 12:59

    Just one fix for Felix's answer and it addresses the issues Martin is seeing. Before closing a socket, all data being sent from the client should be received (using for example do_recv from gen_tcp description).

    Otherwise there's a race condition for the browser/proxy sending the HTTP request being quick enough to send the http request before the socket is closed.

提交回复
热议问题