What is Megaphone?

What is Megaphone?
The Megaphone project is about enhancing open source chat software. Specifically, the goal is to allow ejabberd to support 1,000,000 simultaneous users. See The Plan page for more details on how I plan to solve this problem. See the About this Blog page for more details on why I created this blog.

Wednesday, February 15, 2012

Foo Luck

Previously...
  • I encountered some problems with states.
  • I completed testing for receiving data from the BOSH client.
  • I puzzled through some ejabberd issues with send.

Unfortunately, I did not make as much progress as I had hoped for.  I'd like to say this was someone else's fault, so I will go ahead and blame this on Clippy, the evil paper clip from Office <insert date here>.  That's right folks, I was all set to make some serious progress when he came storming in and messed up everything.

At any rate, I created some more test code:


test_sender_receiver(Port) ->
    io:format("trying to connect to server via port ~p~n", [Port]),
    {ok, Socket} = gen_tcp:connect("localhost", Port, [binary, {packet, 0}]),
    gen_tcp:controlling_process(Socket, self()),
    test_sender_loop(Socket).

test_sender_loop(Socket) ->
    io:format("socket ~p~n", [Socket]),
    {ok, Data} = gen_tcp:recv(Socket, 0),
    io:format("received ~p~n", [Data]),
    test_sender_loop(Socket).


test_send() ->
    start_test(),
    spawn(?MODULE, test_sender_receiver, [4567]),
    receive after 1000 -> ok end,
    send(24, "<body>some response</body>").

When running this I get the following error:


=ERROR REPORT==== 15-Feb-2012::19:24:30 ===
Error in process <0.35.0> with exit value: {{badmatch,{error,einval}},[{megaphone,test_sender_loop,1}]}

I think I could probably clear this problem up, but I'm too lazy to do that right now, so I'll just leave it at that.

Next time: hopefully completed sender testing.

No comments:

Post a Comment