Question
Programming Assignment 1 Socket programming: Using TCP connection Use C Language. Launch two virtual machines, and execute client on one and server
Programming Assignment 1
Socket programming: Using TCP connection
Use C Language.
- Launch two virtual machines, and execute client on one and server on the other.
- The client (tcpClient.c) would send a message to the server (no more than 100 bytes of message) using TCP connection (SOCK STREAM).
- The server (tcpServer.c) would accept the message, convert it to upper case,and send this message back to the client, along with the length of the message. Use port 8088 for the server side.
- Change tcpClient.c to first read the length of the bytes of the message received from the server, and then print the received message. Send the length of the message (an integer between 0 and 100) as an 8-bit integer. The client output should look like the following:
client: connecting to
where <server ip address> is the ip address you configured at the server side of the virutal machine.
You can check the ip address of a linux OS by executing the command: ifconfig -a on the OS terminal. It will display all the network interfaces along with it's assigned ip address. The <message length> is the total length of the message received by the client in bytes, and <your message> is the message sent by client to the server displayed in upper case. Note: You shouldn't convert the message to upper case on the client side.
- (Using UDP connection
Repeat the same experiment but using UDP connection (SOCK DGRAM) instead of a TCP connection.
- Short Answer Questions
- What happens when you use the same port numbers on both sides: client and server? Do these ports interfere with each other?
- Set the port of the server side to less than 1024 and then try to run your codeagain. Why is it asking to enter your admin password to run the program?
- (TCP is a byte-stream oriented protocol and UDP is a message oriented protocol. Explain what does it mean with an example.
Replace 8.8.8.8 with the ip address of the other VM or the host machine.
- Deliverables
- Create a README pdf file with your group member names, the lines of code that each memberhas contributed for this assignment (two or more members may work on same section of the code), solution for the Short Answer Questions, and instructions on how to run your code. Moreover, use of make is encouraged (not required) for the compilation and execution of your programming assignment.
- Create four source files named tcpClient.c, tcpServer.c, udpClient.c, udpServer.c.
- Create a README file .
Step by Step Solution
3.43 Rating (156 Votes )
There are 3 Steps involved in it
Step: 1
Heres a basic outline of how you can implement the TCP clientserver communication in C language tcpS...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started