Day 50

29 Jul 2012

Today, I was trying to build an echo server with C.

I have gone through so many things.

Configuring Makefile is the first hurdle. It took me like 2 hours to make it work correctly. Setting the testing framework is another hurdle.

Anyway, a big thank to Zed Shaw for his awesome tutorial, Learn C the hard way.

Then I have to read all about the C10K problem.

People, there is no easy way to scale a TCP server. You have to implement an asynchronous server.

Well, you can use libevent to implement it, and you can just follow this tutorial.

And, finally, today I have coded an asynchronous server, and I use a ring buffer (from Zed Shaw) to store data, and I have coded the architecture for reading, writing, and changing state (of the RTMP protocol).

Woohoo, I can feel that I will finish it tomorrow :D.

Man, I am a god!