Hi all and thank you for the Erlang Factory talks<br><br>I have tried to implement a very basic erlang tcp server which accepts requests and forwards everything to rabbitmq exchanges. This is meant to be a workaround the lack of a 0.8 C client, I am trying to get Postgresql to send notifications through rabbitmq. Things work as expected up to a point, until I get <br>
<br>{{badmatch,{error,emfile}},[{cinumber_daemon,connect,1}]}<br><br>followed by<br><br>Broker forced connection: 541 -&gt; &lt;&lt;&quot;INTERNAL_ERROR&quot;&gt;&gt;<br><br>I am pretty much an Erlang newbie, so please forgive me if this is not really a rabbitmq issue. This could be useful to others, too.<br>
<br>cheers, Michael<br><br>Here is the relevant part of the code (I am certain recv_loop terminates):<br>recv_loop also does all the rabbity stuff (closes channel, closes connection)<br><br>--------------------------------------------------------------------------------------------------<br>
<br><div style="margin-left: 40px;">start_server() -&gt;<br>    % start up the service and error out if we cannot<br>    case gen_tcp:listen(?LISTEN_PORT, ?TCP_OPTS) of<br>        {ok, Listen} -&gt;<br>            spawn(?MODULE, connect, [Listen]),<br>
            io:format(&quot;~p Server Started.~n&quot;, [erlang:localtime()]),<br>
            sleep(infinity);<br>        Error -&gt;<br>            io:format(&quot;Error: ~p~n&quot;, [Error])<br>    end.<br><br>connect(Listen) -&gt;<br>    {ok, Socket} = gen_tcp:accept(Listen),<br>    inet:setopts(Socket, ?TCP_OPTS),<br>

    % kick off another process to handle connections concurrently<br>    spawn(fun() -&gt; connect(Listen) end),<br>    recv_loop(Socket),<br>    gen_tcp:close(Socket),<br>    exit(normal).<br></div><br>