How it works...
We start by defining two strings by the names of msgReceived and msgforclient, both of which are of size 255. These two strings will be used to receive the message from and send a message to the client, respectively. Then, we will define two variables, server_Address and client_Address, of type sockaddr_in. These structures will reference the socket's elements and store the server's and client's addresses, respectively. We will invoke the bzero function to initialize the server_Address structure, that is, zeros will be filled in for all of the members of the server_Address structure.
The server, as expected, waits for the datagram from the client. So, the following text message is displayed on the screen: Waiting for the message ...
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