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

Tom van Neerijnen <>
Sun Mar 1 15:35:15 CET 2015


bind_address,{127,0,0,1} should be bind_address,{0,0,0,0}. 127.0.0.1 is the
loopback interface and only receives connections from the same host which
is why you can't connect from other devices.

On Sun, Mar 1, 2015 at 1:54 AM, austin aigbe <> wrote:

> Still the same experience. I still can't connect.
> What could be wrong?
>
> python -m SimpleHTTPServer works well and this implies it's not my network
> configuration but an application issue. In this case my web_server.erl
> application. So what am I doing incorrectly?
>
> On Sun, Mar 1, 2015 at 1:26 AM, Leonard Boyce <
> > wrote:
>
>> 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
>>>
>>>
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
>


-- 
Thomas van Neerijnen
+4477 1709 7670
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150301/82ace990/attachment.html>


More information about the erlang-questions mailing list