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?
It extracts the first connection request on the queue of pending connections for the listening socket, sockfd, creates a new connected socket, and returns a new file descriptor referring to that socket. At this point, the connection is established between client and server, and they are ready to transfer data.
Most current network programming is done either using sockets directly, or using various other layers on top of sockets.
The client in socket programming must know which information? Explanation: The client in socket programming must know IP address of Server as it has to use that IP address in order to initialize the socket class constructor. That is how the client requests a connection to the server.
Well, it is not hard but it requires experience and some googling. For example setting various time-outs or tricks how to prevent blocking calls. Primitive sockets are very simple but all calls are blocking and this will make user application unresponsive.
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.
UNIX Network Programming, Volume 1, Second Edition: Networking APIs: Sockets and XTI.
Then go from there.
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