Question

Please perform the code in the ubuntu terminal: Create and configure a Client / Server architecture...

Please perform the code in the ubuntu terminal:

Create and configure a Client / Server architecture that allows the following

operations with files from / to the Client:

Copy, move, delete

Chat between users that allows the exchange of

files, including videos

Homework Answers

Answer #1

Well if you mean that coding in ubuntu terminal is opening "Vi" and writing the script in python and then executing that script from ubuntu terminal. Then you are in luck!!!

So, I looked your answer and it is quite interesting, it has some various subparts and I tried to cover all of them, So lets go at each part one by one.

Problem1 : Creating a socket, basically creating two py files one named socket _server and another socket_client.

I will recommend that you should use sublime or any other interface which suits you.

import socket


def server_program():
  
host = socket.gethostname()
port = 7500  

server_socket = socket.socket()  
  
server_socket.bind((host, port))
server_socket.listen(2)
conn, address = server_socket.accept()  
print("Connection from: " + str(address))

def Messaging():


while True:
  
data = conn.recv(1024).decode()
if not data:
break
print("from connected user: " + str(data))
data = input(' -> ')
conn.send(data.encode())

def FileTransfering():

    filename='mytext.txt'
    f = open(filename,'rb')
    l = f.read(1024)
    while (l):
       conn.send(l)
       print('Sent ',repr(l))
       l = f.read(1024)
    f.close()

conn.close()

if __name__ == '__main__':

server_program()

Now, Socket_client.py

import socket


def client_program():
host = socket.gethostname()  
port = 7500  

client_socket = socket.socket()  
client_socket.connect((host, port))

message = input(" -> ")  

def Messaging():

while message.lower().strip() != 'bye':
client_socket.send(message.encode())  
data = client_socket.recv(1024).decode()  

print('Received from server: ' + data)  

message = input(" -> ")  

def FileTransfering():

while True:
        print('receiving data...')
        data = s.recv(1024)
        print('data=%s', (data))
        if not data:
            break
        # write data to a file
        f.write(data)

client_socket.close()


if __name__ == '__main__':
client_program()

So, look for syntax errors:

Working code is given in the secreenshot

Now, follow the steps to run these codes in the terminal.

Step1:- Open two terminals.

Step2:- In the first terminal locate the py file then type the command python3 socketserver.py and run it. Nothing will happen.

Step3:- In the second terminal locate py file location then type the command python3 socketclient.py and run it. Then type hie.

step4:- Hie will be seen in the first terminal.

Do like the answer.

Now, I hope it helps, if you have any doubt regarding this, just comment it, I will reply as fast as possible.

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
Operating Systems For Linux/Ubunbtu, create and configure a client / server architecture that allows the following...
Operating Systems For Linux/Ubunbtu, create and configure a client / server architecture that allows the following operations with files from / to the client: -Copy, move, delete. -Chat between users that allows the exchange of files, including videos.
Import two virtual machines (Ubuntu) and name it as Server and Client and perform/ type commands...
Import two virtual machines (Ubuntu) and name it as Server and Client and perform/ type commands for the following. 1. Assign IP address 192.168.4.2 (subnet mask 255.255.255.0) to Server machine. 2. Assign IP address 192.168.4.5 (subnet mask 255.255.255.0) to Client machine. 3. Change the network adapter settings of Server and Client to bridged adapter. 4. Perform the command to find/display the IP addresses of Server and Client. 5. Perform the command to test the connectivity between Server and Client. 6....
Create a very simple TCP Application in JAVA. You will create a client and a server....
Create a very simple TCP Application in JAVA. You will create a client and a server. The client must execute after you start the server. Here is what they will do. The client will read from the console a string that the users enters. This string will be the name of the user, let's say Bob. The client then sends the name, Bob, in an Object Stream, to the server. The server will receive this Object Stream and send to...
PLEASE DO QUICK LINUX ASSIGNMENT PLEASE ILL THUMBS UP You need to paste the command and...
PLEASE DO QUICK LINUX ASSIGNMENT PLEASE ILL THUMBS UP You need to paste the command and the output in a word document and submit it. Part1: 1. Log in to Linux using your user account name and password. 2. If you logged in using a graphical login screen, open a terminal window by clicking on the icon in the lower left corner of the desktop to open the main menu, then selecting System Tools, then Terminal. A terminal window opens....
PLEASE USING C# TO SOLVE THIS PROBLEM. THANK YOU SO MUCH! a. Create a project with...
PLEASE USING C# TO SOLVE THIS PROBLEM. THANK YOU SO MUCH! a. Create a project with a Program class and write the following two methods (headers provided) as described below: - A Method, public static int InputValue(int min, int max), to input an integer number that is between (inclusive) the range of a lower bound and an upper bound. The method should accept the lower bound and the upper bound as two parameters and allow users to re-enter the number...
Please review the following below and provide , one-page reaction to this budget proposal. 1. Budget...
Please review the following below and provide , one-page reaction to this budget proposal. 1. Budget The President’s Budget and Health Care While the president’s budget is not likely to be acted upon by Congress, it does signal what the administration’s priorities are—as well as what policy initiatives they might push. Repeal the Affordable Care Act: The administration’s budget includes a plan that is based upon the plan put forward by Sens. Lindsey Graham (R-SC) and Bill Cassidy (R-LA) last...
I did already posted this question before, I did get the answer but i am not...
I did already posted this question before, I did get the answer but i am not satisfied with the answer i did the code as a solution not the description as my solution, so i am reposting this question again. Please send me the code as my solution not the description In this project, build a simple Unix shell. The shell is the heart of the command-line interface, and thus is central to the Unix/C programming environment. Mastering use of...
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...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary rivals? How will the acquisition of Reebok by Adidas impact the structure of the athletic shoe industry? Is this likely to be favorable or unfavorable for New Balance? 2- What issues does New Balance management need to address? 3-What recommendations would you make to New Balance Management? What does New Balance need to do to continue to be successful? Should management continue to invest...
Sign In INNOVATION Deep Change: How Operational Innovation Can Transform Your Company by Michael Hammer From...
Sign In INNOVATION Deep Change: How Operational Innovation Can Transform Your Company by Michael Hammer From the April 2004 Issue Save Share 8.95 In 1991, Progressive Insurance, an automobile insurer based in Mayfield Village, Ohio, had approximately $1.3 billion in sales. By 2002, that figure had grown to $9.5 billion. What fashionable strategies did Progressive employ to achieve sevenfold growth in just over a decade? Was it positioned in a high-growth industry? Hardly. Auto insurance is a mature, 100-year-old industry...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT