How it works...
We will start by defining a string of size 255, and a server_Address variable of type sockaddr_in. This structure references the socket's elements. Then, we will invoke the socket function to create a socket by the name of serverSocket. A socket is an endpoint for communication. The address family that's supplied for the socket is AF_INET, and the socket type selected is the stream socket type, since the communication that we want is of a continuous stream of characters.
The address family that's specified for the socket is AF_INET, and is used for IPv4 internet protocols. The port number that's specified for the socket is 2000. Using the htons function, the short integer 2000 is converted into the network byte order before ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access