That depends on a lot of things like the OS ,your compiler etc.
There are a lot of libraries available which you can use on multiple OSs which provide raw packet access for TCP/IP,UDP,ethernet cards etc.
Look to http://www.google.com/ for info,downloads
Best of luck,you got a lot of reading to do.
(Btw,if you use windows look for WinPcap )
http://winpcap.polito.it/