<br><br><div class="gmail_quote">On Mon, Nov 24, 2008 at 10:18 PM, Matthias Lang <span dir="ltr"><<a href="mailto:matthias@corelatus.se">matthias@corelatus.se</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Monday, November 24, Paul Oliver wrote:<br>
> Hi all,<br>
><br>
> I have a curious bug that I've tracked down to a call to<br>
> gen_tcp:controlling_process. From the stack trace (simple example<br>
> reproduced below) it seems that the port in question definitely exists, but<br>
> the call to inet_db:lookup fails. Has anyone seen this before or got any<br>
> advice?<br>
<br>
</div>This seems too obvious to be your real problem, but just in case,<br>
the second command isn't handling the return correctly. You probably<br>
meant:<br>
<br>
{ok, Sock} = gen_tcp:connect(...<br>
<br>
Matt<br>
<div><div></div><div class="Wj3C7c"></div></div></blockquote><div><br>Hi Matt,<br><br>Ah yes. Thanks for pointing that out! Yes, seems fine now:<br><br>1> mochiweb_socket_server:start( [{ip, "<a href="http://127.0.0.1">127.0.0.1</a>"}, {loop, {connection, start}}, {name, badger}, {port, 8888}]).<br>
{ok,<0.32.0>}<br>2> {ok, Sock} = gen_tcp:connect('<a href="http://127.0.0.1">127.0.0.1</a>', 8888, [binary, {packet, line}, {nodelay, true}], 3000000).<br>{ok,#Port<0.496>}<br>3> Sock.<br>#Port<0.496><br>
4> gen_tcp:controlling_process(Sock, self()).<br>ok<br>5> <br><br>Back to the drawing board!<br><br>Cheers,<br>Paul. <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div class="Wj3C7c"><br>
><br>
> Thanks!<br>
> Paul.<br>
><br>
> Erlang (BEAM) emulator version 5.6.5 [source] [async-threads:0]<br>
> [kernel-poll:false]<br>
><br>
> Eshell V5.6.5 (abort with ^G)<br>
> 1> mochiweb_socket_server:start( [{ip, "<a href="http://127.0.0.1" target="_blank">127.0.0.1</a>"}, {loop, {connection,<br>
> start}}, {name, badger}, {port, 8888}]).<br>
> {ok,<0.32.0>}<br>
> 2> Sock = gen_tcp:connect('<a href="http://127.0.0.1" target="_blank">127.0.0.1</a>', 8888, [binary, {packet, line},<br>
> {nodelay, true}], 3000000).<br>
> {ok,#Port<0.496>}<br>
> 3> gen_tcp:controlling_process(Sock, self()).<br>
><br>
> =ERROR REPORT==== 24-Nov-2008::20:59:12 ===<br>
> ** Generic server badger terminating<br>
> ** Last message in was {'EXIT',<0.30.0>,<br>
> {function_clause,<br>
> [{inet_db,lookup_socket,[{ok,#Port<0.496>}]},<br>
> {gen_tcp,controlling_process,2},<br>
> {erl_eval,do_apply,5},<br>
> {shell,exprs,6},<br>
> {shell,eval_exprs,6},<br>
> {shell,eval_loop,3}]}}<br>
> ** When Server state == {mochiweb_socket_server,8888,<br>
> {connection,start},<br>
> {local,badger},<br>
> 2047,<br>
> {127,0,0,1},<br>
> #Port<0.488>,<0.37.0>,30}<br>
> ** Reason for termination ==<br>
> ** {function_clause,[{inet_db,lookup_socket,[{ok,#Port<0.496>}]},<br>
> {gen_tcp,controlling_process,2},<br>
> {erl_eval,do_apply,5},<br>
> {shell,exprs,6},<br>
> {shell,eval_exprs,6},<br>
> {shell,eval_loop,3}]}<br>
> ** exception exit: function_clause<br>
> in function inet_db:lookup_socket/1<br>
> called as inet_db:lookup_socket({ok,#Port<0.496>})<br>
> in call from gen_tcp:controlling_process/2<br>
> 4><br>
<br>
</div></div>> _______________________________________________<br>
> erlang-questions mailing list<br>
> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
> <a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div><br>