A great paper by Nitr0gen covering raw socket programming in great deal. Good place to start, the paper can be found here. I also recommend Unix Network Programming Volume 1, by Stephens if you want...