Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Good Readings on Unix/Linux Socket Programming?

Tags:

c++

linux

sockets

though I haven't worked with sockets professionally, I find them interesting. I read some part of Unix Network Programming by Richard Stevens (considered to be the Bible I suppose as it is referred by everyone I ask) but the problem is the examples require a universal header unp.h which is a PIA to use.

Can some of you suggest a good reading for socket programming in Unix/Linux? Considering I am relatively experienced C/C++ coder.

like image 793
rocknroll Avatar asked Jul 28 '09 05:07

rocknroll


People also ask

How do I use socket programming in Linux?

Create a socket with the socket() system call. Bind the socket to an address using the bind() system call. For a server socket on the Internet, an address consists of a port number on the host machine. Accept a connection with the accept() system call.

What is socket programming in Unix?

A Unix Socket is used in a client-server application framework. A server is a process that performs some functions on request from a client. Most of the application-level protocols like FTP, SMTP, and POP3 make use of sockets to establish connection between client and server and then for exchanging data.

Which information is needed for socket programming?

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.

Does Linux use sockets?

In this tutorial you explored how different kinds of sockets are used on a Linux system. You learned about stream-based sockets, which typically use TCP for network communication. You also learned about datagram-based sockets, which use UDP to send data over networks.


2 Answers

The canonical reference is UNIX Network Programming by W. Richard Stevens. upn.h is really just a helper header, to make the book examples clearer - it doesn't do anything particularly magic.

To get up and running very quickly, it's hard to go past Beej's Guide To Network Programming using Internet Sockets.

like image 182
caf Avatar answered Sep 22 '22 18:09

caf


I used Beej's Guide to Network Programming

There's plenty of examples of client and server code with explanations at each step of the way.

like image 26
temp Avatar answered Sep 21 '22 18:09

temp