<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Basically, 0.0.0.0 means that it will bind on any available netwprk interface on the local machine. <span style="background-color: rgba(255, 255, 255, 0);">Visiting the link you will find a more complete explanation why this happens.</span></div><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><div><a href="http://serverfault.com/q/78048">http://serverfault.com/q/78048</a></div><div><br></div><div>/Ioannis</div><div><br>1 mar 2015, 22:20, ο/η austin aigbe <<a href="mailto:eshikafe@gmail.com">eshikafe@gmail.com</a>> έγραψε:<br><br></div><blockquote type="cite"><div><div dir="ltr">Thanks Thomas.<div><br></div><div>Changing the bind_address to 0.0.0.0 solved the issue.</div><div><br></div><div>Surprisingly, the python server is also using 0.0.0.0 and I did not even notice it.</div><div><br></div><div><div>C:\Users\eausaig>python -m SimpleHTTPServer</div><div>Serving HTTP on <b>0.0.0.0</b> port 8000 ...</div></div><div><br></div><div><br></div><div>Working version:<br><br></div><div><div>-module(web_server).</div><div>-export([start/0, stop/0]).</div><div><br></div><div>-define(PORT, 8000).</div><div>-define(SERVER_NAME, "server1").</div><div>-define(ROOT,"C:/Users/eausaig/Desktop/web_server").</div><div><br></div><div>start() -></div><div>inets:start(),</div><div>{ok, _} = inets:start(httpd, </div><div><span class="" style="white-space:pre"> </span>[{port, ?PORT},</div><div><span class="" style="white-space:pre"> </span> {server_name,?SERVER_NAME}, </div><div><span class="" style="white-space:pre"> </span> {server_root,?ROOT},</div><div><span class="" style="white-space:pre"> </span> {document_root,?ROOT},</div><div><span class="" style="white-space:pre"> </span> {bind_address,{<b>0,0,0,0</b>}},</div><div><span class="" style="white-space:pre"> </span> {directory_index,["index.html"]},</div><div><span class="" style="white-space:pre"> </span> {server_tokens, full}]).</div><div><br></div><div>stop() -></div><div><span class="" style="white-space:pre"> </span>[{_,_},{_,P2}] = inets:services(),</div><div><span class="" style="white-space:pre"> </span>ok = inets:stop(httpd, P2).</div></div><div><br></div><div>BR,</div><div>Austin<br><div class="gmail_extra"><br><div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote"><div dir="ltr" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;font-family:Arial,Helvetica,sans-serif;font-size:13px">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.<br></div><div dir="ltr" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;font-family:Arial,Helvetica,sans-serif;font-size:13px"><br></div><div dir="ltr" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;font-family:Arial,Helvetica,sans-serif;font-size:13px">-- <br><div style="margin:0px;padding:0px;border:0px;vertical-align:baseline"><div dir="ltr" style="margin:0px;padding:0px;border:0px;vertical-align:baseline"><div style="margin:0px;padding:0px;border:0px;vertical-align:baseline">Thomas van Neerijnen<br></div><div style="margin:0px;padding:0px;border:0px;vertical-align:baseline">+4477 1709 7670</div><div style="margin:0px;padding:0px;border:0px;vertical-align:baseline"><br></div></div></div></div><div>On Sun, Mar 1, 2015 at 1:26 AM, Leonard Boyce <span dir="ltr"><<a href="mailto:leonard.boyce@lucidlayer.com" target="_blank">leonard.boyce@lucidlayer.com</a>></span> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><p dir="ltr">Removing the bind_address or set it to a non-localhost IP which is bound to your machine should sort it out.</p>
<p dir="ltr">Leonard</p>
<div class="gmail_quote"><div><div class="h5">On Feb 28, 2015 6:19 PM, "austin aigbe" <<a href="mailto:eshikafe@gmail.com" target="_blank">eshikafe@gmail.com</a>> wrote:<br type="attribution"></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Hi,<div><br></div><div>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</div><div><br></div><div>However, I am able to access the python based simpleHTTPServer from my Android phone (using http://<PC IP address>:8000) via WiFi.<br><div><br></div><div>How do I make my erlang inets server accessible from an external PC or phone?</div><div><br></div><div>OS: Windows 7</div><div><br></div><div>%-----------------------</div><div>% web_server.erl</div><div>%-------------------------</div><div><div>-module(web_server).</div><div>-export([start/0, stop/0]).</div><div><br></div><div>-define(PORT, 8000).</div><div>-define(SERVER_NAME, "server1").</div><div>-define(ROOT,"C:/Users/eausaig/Desktop/web_server").</div><div><br></div><div>start() -></div><div>{ok, _} = inets:start(httpd, </div><div><span style="white-space:pre-wrap"> </span>[{port, ?PORT},</div><div><span style="white-space:pre-wrap"> </span> {server_name,?SERVER_NAME}, </div><div><span style="white-space:pre-wrap"> </span> {server_root,?ROOT},</div><div><span style="white-space:pre-wrap"> </span> {document_root,?ROOT},</div><div><span style="white-space:pre-wrap"> </span> {bind_address,{127,0,0,1}},</div><div><span style="white-space:pre-wrap"> </span> {directory_index,["index.html"]},</div><div><span style="white-space:pre-wrap"> </span> {server_tokens, full}]).</div><div><br></div><div>stop() -></div><div><span style="white-space:pre-wrap"> </span>[{_,_},{_,P2}] = inets:services(),</div><div><span style="white-space:pre-wrap"> </span>ok = inets:stop(httpd, P2).</div></div><div><br></div></div><div>BR,</div><div>Austin</div></div>
<br></div></div>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div>
</blockquote></div><br></div></div></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>erlang-questions mailing list</span><br><span><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a></span><br><span><a href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a></span><br></div></blockquote></body></html>