[erlang-questions] Unable to access my inets http server from my phone or external PC

Leonard Boyce <>
Sun Mar 1 01:26:26 CET 2015


Removing the bind_address or set it to a non-localhost IP which is bound to
your machine should sort it out.

Leonard
On Feb 28, 2015 6:19 PM, "austin aigbe" <> wrote:

> Hi,
>
> I can't seem to access the erlang inets http server (web_server.erl) from
> my Android phone (using http://<PC IP address>:8000) via WiFi
>
> However, I am able to access the python based simpleHTTPServer from my
> Android phone (using http://<PC IP address>:8000) via WiFi.
>
> How do I make my erlang inets server accessible from an external PC or
> phone?
>
> OS: Windows 7
>
> %-----------------------
> % web_server.erl
> %-------------------------
> -module(web_server).
> -export([start/0, stop/0]).
>
> -define(PORT, 8000).
> -define(SERVER_NAME, "server1").
> -define(ROOT,"C:/Users/eausaig/Desktop/web_server").
>
> start() ->
> {ok, _} = inets:start(httpd,
> [{port, ?PORT},
>  {server_name,?SERVER_NAME},
>  {server_root,?ROOT},
>  {document_root,?ROOT},
>  {bind_address,{127,0,0,1}},
>  {directory_index,["index.html"]},
>  {server_tokens, full}]).
>
> stop() ->
> [{_,_},{_,P2}] = inets:services(),
> ok = inets:stop(httpd, P2).
>
> BR,
> Austin
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150228/65a643c4/attachment.html>


More information about the erlang-questions mailing list