12

Could anybody please tell me which is best guide/book/material for socket programming in C? I am reading beej's guide for network programming but it just gives an overview.
Can you suggest any other books or guides?

Sinan Ünür
  • 116,958
  • 15
  • 196
  • 339
Vijay
  • 65,327
  • 90
  • 227
  • 319
  • 1
    Beej's guide for network programming is more than enough for most simple applications. – Kylotan Oct 20 '09 at 14:32
  • I agree with Kylotan, Beej's guide is pretty good. If that's not good enough then I guess go straight to UNIX Network Programming Volume 1. :) – BobbyShaftoe Oct 21 '09 at 00:18
  • I think this topic is also discussed in the APUE book in case you already have access to it :-). – p4bl0 Oct 25 '09 at 10:19

2 Answers2

19

UNIX Network Programming, Volume 1, Second Edition: Networking APIs: Sockets and XTI.

Then go from there.

Sinan Ünür
  • 116,958
  • 15
  • 196
  • 339
  • agree. it's something like the Bible. after done, study Highly-concurrent Programming Models. suggest that if on a linux 2.6x study to use epoll, if win/msvc, try competion port. and new AIO. visit Effo NetMsg C/C++ open source project to learn more about epoll, network messaging and Highly-concurrent Programming Models. – Test Oct 20 '09 at 14:33
  • 2
    Possibly stupid question: is it worth reading if you plan to program on windows? – Niki Oct 20 '09 at 15:57
  • 1
    @nikie Yes, IMHO. But, I remember benefiting from the 1995 edition of http://www.amazon.com/Windows-Sockets-Network-Programming-paperback/dp/0768682320/ – Sinan Ünür Oct 20 '09 at 16:02
  • @sinan this should certainly apply and work on any modern linux distro right ? – gideon Apr 06 '15 at 16:54
  • should I read volume 2 after I have read volume 1 of socket programming? The volume 2 is rather IPC then networking – milanHrabos Jan 27 '21 at 20:53
5

Start with UNIX Network Programming as Sinan Ünür said. Read TCP/IP Illustrated Volume 1 after you have decent grasp on sockets. Don't skip this since it will increase your knowledge of the various network protocols dramatically. FWIW, I think that these two books should form the foundation of anyone that even considers doing network programming at the socket layer.

Community
  • 1
  • 1
D.Shawley
  • 58,213
  • 10
  • 98
  • 113
  • should I read volume 2 after I have read volume 1 of socket programming? The volume 2 is rather IPC then networking – milanHrabos Jan 27 '21 at 20:52
  • UNIX Network Programming vol 2 isn't really that useful for IP-based network programming. It's useful if you are doing thread-based programming. I would take a look at Stevens' Advanced Programming in the UNIX environment for more UNIX system programming outside of networking. – D.Shawley Jan 28 '21 at 23:53
  • I really appreciate the UNIX system programming, but I am rather interested in creating CGI in c or c++, after comprehending sockets, I cannot find a the same quality book for CGI/web development in c++ (which would follow the socket api knowledge now I have). Do you know any? – milanHrabos Jan 29 '21 at 00:01