I am trying to download and run the c code on Linux for
UNIX Network Programming, Volume 1, Second Edition: Networking APIs: Sockets and XTI, Prentice Hall, 1998, ISBN 0-13-490012-X. It is by W. Stevens Richard
http://kohala.com/start/unpv12e/unpv12e.tar.gz
But, when I build the code, I got error:
gcc -g -O2 -D_REENTRANT -Wall -c -o connect_nonb.o connect_nonb.c
In file included from connect_nonb.c:1:
unp.h:114: error: redefinition of âstruct in_pktinfoâ
make: *** [connect_nonb.o] Error 1
I commented out struct in_pktinfo. Then I got new errors:
gcc -g -O2 -D_REENTRANT -Wall -c -o in_cksum.o in_cksum.c
gcc -g -O2 -D_REENTRANT -Wall -c -o inet_ntop.o inet_ntop.c
inet_ntop.c: In function âinet_ntopâ:
inet_ntop.c:61: error: argument âsizeâ doesnât match prototype
/usr/include/arpa/inet.h:67: error: prototype declaration
make: *** [inet_ntop.o] Error 1
I do not want to debug for the whole 575 files one by one.
Where can I get new code without these errors ? the new version book has bug-free code ?
The old code is only for old OS.
Thanks
well, The Author Richard Stevens passed away in 1999 and the Book is still the a very good reference. You can't say this about a lot of more than 10 year old technical references.
I just fetched the source from http://www.unpbook.com/unpv13e.tar.gz and followed the readme, which basically meant to run ./configure and call make in the directories
/lib
/libfree
/intro
I fixed a single place (libfree/inet_ntop.c:60 and changed size to socklen ) and it compiled on my current Ubuntu. I didn't run it, but I trust that at least the most of it will work.
Richard Stevens books are still outstanding and worth the small effort it needs to keep his sources running.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With