Question: Implement a UDP echo program using socket programming in either C, C++, Java or Python. An echo function may be created in your Server file

Implement a UDP echo program using socket programming in either C, C++, Java or Python.

An echo function may be created in your Server file while a get_stdin function may be created in your Client file.

Server:

Create a socket, IP protocol family, modified UDP protocol.

Establish IP address and port number.

Port numbers are network byte order, please convert it to host byte order and print it.

Echo every datagram.

Echo:

Need to know how big address struct is, len must be set before the call.

Read a datagram from the socket Print out the address of the sender.

Print out if there are errors.

If yes, please print out the correct sections.

Client:

Create a socket, IP protocol family, modified UDP protocol.

Create a sockaddr that will be used to contact the server.

Fill in an address structure that will be used to specify the address of the server you want to connect to.

Server IP address is found by calling with the name of the server.

Copy the IP address into the sockaddr.

Establish the server port number.

Read everything possible and send it to the echo server.

Wait for a reply.

Send what you get back to stdout.

get_stdin:

reads from standard input until EOF is found or the maximum bytes have been read.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!