This is an erlang problem, it seems. I have this code to test the client sending data, written in Actionscript 3:
<br><div class="gmail_quote">

<br>
<div>Code:<div>var socket:Socket=new Socket("localhost", 2345);
<br>
socket.addEventListener(Event.CONNECT, connected);
<br>

<br>
private function connected(event:Event):void {
<br>
    socket.writeInt(12); //packet length, should be correct? 4 bytes each?
<br>
    socket.writeInt(3);
<br>
    socket.writeInt(6);
<br>
    socket.writeInt(9);
<br>
    socket.flush();
<br>
}</div></div>
<br>

<br>
Then I have this small server, written in Erlang:
<br>

<br>
<div>Code:<div>start_nano_server() ->
<br>
    {ok, Listen} = gen_tcp:listen(2345, [binary, {packet, 0},
<br>
                                 {reuseaddr, true},
<br>
                                 {active, true},
<br>
                                {packet_size, 128}]),
<br>
    {ok, Socket} = gen_tcp:accept(Listen),
<br>
    gen_tcp:close(Listen), 
<br>
    receive_data(Socket, []).
<br>

<br>
receive_data(Socket, SoFar) ->
<br>
    receive
<br>
    {tcp,Socket,Bin} ->   
<br>
        receive_data(Socket, [Bin|SoFar]);
<br>
    {tcp_closed,Socket} ->
<br>
        Bytes=list_to_binary(reverse(SoFar)),
<br>
        io:format("~p~n",[Bytes])
<br>
    end.</div></div>
<br>

<br>
Now, no matter what I send from the client, I ALWAYS get
[<<0,0,0,4,0,0,0,32>>] as the response. I can try writing
bytes to the socket directly instead of ints, and I get the same thing.
I can write more or less data, same result. UTF strings same result.
Even when specifying "4" as the packet header length, I just get the
same consistant result of [<<0,0,0,32>>] instead. I don't
understand what I'm doing wrong here.
</div><br>