Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

 

  1. Launch two virtual machines, and execute client on one and server on the other.
  2. The client (tcpClient.c) would send a message to the server (no more than 100 bytes of message) using TCP connection (SOCK STREAM).
  3. 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.
  4. 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 client: received bytes

where <server ip addressis 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 lengthis the total length of the message received by the client in bytes, and <your messageis 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.

 

  1. (Using UDP connection

Repeat the same experiment  but using UDP connection (SOCK DGRAM) instead of a TCP connection.

  1. Short Answer Questions
    1. What happens when you use the same port numbers on both sides: client and server? Do these ports interfere with each other?
    2. 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?
    3. (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.

  1. Deliverables
  2. 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.
  3. Create four source files named tcpClient.c, tcpServer.c, udpClient.c, udpServer.c.
  4. 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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Communications and Networking

Authors: Behrouz A. Forouzan

5th edition

73376221, 978-0073376226

More Books

Students also viewed these Algorithms questions

Question

Write a structured flowchart for prob.2.3

Answered: 1 week ago

Question

What are the four SONET layers?

Answered: 1 week ago

Question

explain the theory of self-efficacy,

Answered: 1 week ago

Question

identify techniques for raising arousal for competition.

Answered: 1 week ago

Question

explain the cognitivemediational model of leadership;

Answered: 1 week ago