How it works...
In the first part of this recipe, we have already defined two strings by the names of msgReceived and msgforclient, both of which are of size 255. We have also defined two variables, server_Address and client_Address, of type sockaddr_in.
Now, you will be prompted to enter a message that is to be sent to the server. The message you enter will be assigned to the msgforserver string. Then, we will invoke the bzero function to initialize the client_Address structure, that is, zeros will be filled in for all the members of the client_Address structure.
Next, we will initialize the members of the client_Address structure to configure the socket. Using the sin_family member, the address family that's specified for the socket is ...
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