i am trying code given in Unix Network Programming by Richard Stevens. but i am not able to get the code to compile.
here is the source code. http://www.cs.cmu.edu/a
That is a BSD-specific API, and linux doesn't support it. The equivalent functionality (not source-compatible) is provided by the netlink socket family. "man 7 netlink" should get you started, but you're likely going to need to do some porting work.