Question

The Problem: In this assignment, students are required to implement a simple communication between two entities...

The Problem:
In this assignment, students are required to implement a simple communication between two entities (that is, device-to-device or device-to-server, depending on the selected protocol) using any two of these protocols. The information to be exchanged in this communication can be simple (a text of one line) or complex (a large text, audio, or video file).
General Rules:
1. Students are required to work in teams of three with only one team being of two.
2. Teams are required to submit a report about their work. The format of this report is as follows:
a. Objective: Explain the problem you are working on (that is, exchange of simple messages, exchange of an audio file … etc.) and the name of the application protocols you used in your work.
b. Application Protocol: Provide full description (supported with diagrams and figures whenever necessary) of the application protocols you selected in your work. Provide a comparison between them in terms of the complexity of the design/implementation and performance.
c. Testing: Provide sufficient snapshots that show how to test the execution of your final implementations.
3. The report should be submitted

Homework Answers

Answer #1

Here the communication is between a client and server. This can be regarded as a simple chat program exchanging small texts. The protocol used is IP.

This program is written in Python.

server.py:

                                                   
import socket                                                                   
                                                                                
# server host address, denotes localhost if empty string.                       
HOST = '';                                                                      
# port which is used to communicate server and client programs                  
PORT = 40005;                                                                   
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sc:                   
    sc.bind((HOST, PORT));                                                      
    sc.listen(1);                                                               
    connection, address = sc.accept()                                           
    with connection:                                                            
        print('Connected by client host: %s' % repr(address))                   
        while True:                                                             
            data = connection.recv(1024)                                        
            if not data:                                                        
                break;                                                          
            # printing client message here.                                     
            print("Received from client: %s" % repr(data))                    
            data_to_send = input("Enter message to client:")               
            if not data_to_send:                                                
                break;                                                          
            # sending message as bytes to client.                               
            connection.sendall(bytearray(data_to_send, 'utf-8'))

client.py:

# Chatting client program                                                       
import socket                                                                   
                                                                                
# host address where client program is running.                                 
HOST = '';                                                                      
# port on which server and client programs are communicating.                   
PORT = 40005;                                                                   
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sc:                   
    sc.connect((HOST, PORT))                                                    
    while True:                                                                 
        data_to_send = input("Enter message to server: ")                     
        if not data_to_send:                                                    
            break;                                                              
        # sending message as bytes to server.                                   
        sc.sendall(bytearray(data_to_send, 'utf-8'))                          
        data = sc.recv(1024);                                                   
        # printing server message.                                              
        print('Received from server: %s'% repr(data))
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Overview Your assignment is to complete a wireless network design for a small company. You will...
Overview Your assignment is to complete a wireless network design for a small company. You will place a number of network elements on the diagram and label them appropriately. A network diagram is important to communicate the design features of a network between network administrators, system administrators and cyber-security analysts. It helps to create a shared mental model between these different technologists, yet each will have their own perspective on what is important to have documented on the diagram. Please...
Plagiarism Certification Tests for Undergraduate College Students and Advanced High School Students These tests are intended...
Plagiarism Certification Tests for Undergraduate College Students and Advanced High School Students These tests are intended for undergraduate students in college or those under 18 years of age. Read these directions carefully! The below test includes 10 questions, randomly selected from a large inventory. Most questions will be different each time you take the test, You must answer at least 9 out of 10 questions correctly to receive your Certificate. You have 40 minutes to complete each test, and you...
CASE STUDY ON LEADERSHIP/ Aidensfield hospital currently faces major problems with staff, management, general performance and...
CASE STUDY ON LEADERSHIP/ Aidensfield hospital currently faces major problems with staff, management, general performance and service quality. It is conceivable that these problems are related to the ‘leadership’ styles adapted by those in charge. The senior management have proposed some changes within the organisation to hopefully make improvements but making such decisions requires an in-depth understanding of what is going wrong and why. Leadership as a concept is often considered in isolation when in reality, it is coherent with...
Using the model proposed by Lafley and Charan, analyze how Apigee was able to drive innovation....
Using the model proposed by Lafley and Charan, analyze how Apigee was able to drive innovation. case:    W17400 APIGEE: PEOPLE MANAGEMENT PRACTICES AND THE CHALLENGE OF GROWTH Ranjeet Nambudiri, S. Ramnarayan, and Catherine Xavier wrote this case solely to provide material for class discussion. The authors do not intend to illustrate either effective or ineffective handling of a managerial situation. The authors may have disguised certain names and other identifying information to protect confidentiality. This publication may not be...
The Business Case for Agility “The battle is not always to the strongest, nor the race...
The Business Case for Agility “The battle is not always to the strongest, nor the race to the swiftest, but that’s the way to bet ’em!”  —C. Morgan Cofer In This Chapter This chapter discusses the business case for Agility, presenting six benefits for teams and the enterprise. It also describes a financial model that shows why incremental development works. Takeaways Agility is not just about the team. There are product-management, project-management, and technical issues beyond the team’s control. Lean-Agile provides...