Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In python, build a simple distributed service by using pickling and networks. Use TCP to coordinate between a host and a server. The host will

In python, build a simple distributed service by using pickling and networks.

Use TCP to coordinate between a host and a server. The host will send a pickled object

and the python source to the server. The server will run the python source with the pickle and

return the results. One server, and its program should add two numbers together and return them.

The object that gets pickled should have a result entry.

The application the server runs should have a run method and send its pickled output (after

invoking run) to stdout (sys.stdout).

1 use sys.argv to get the name of the pickled input.

2 unpickle it.

3 invoke the objects run method

4 pickle it to sys.stdout.

(There is a reason for this.)

Youll need to manually start both the host and server. (a full package like MPI has a

method to start and synchronize servers.) Use localhost (127.0.0.1) for the IP address. It may

be convenient to use two ports and make both host and server a tcp client and a tcp server.

Host

Create the link to the server. Create an instance of the data object, pickle it and send it

to the server along with the python code needed to run the calculation. Wait for a reply.

Unpickle the reply and print the result.

Server

Listen for the hosts message. Receive both the pickled object and the python code - write

them as files. Invoke the python code with the pickled file as a command line argument.

Invoke the python code (HINT use the subprocess package and subprocess.check output

method to do this.) Return the pickled output to the host.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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_2

Step: 3

blur-text-image_3

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

Database Application Development And Design

Authors: Michael V. Mannino

1st Edition

0072463678, 978-0072463675

More Books

Students also viewed these Databases questions

Question

What seven tips would you give to a beginning blogger?

Answered: 1 week ago

Question

=+(0

Answered: 1 week ago

Question

What are the five benefits of keeping a complaints register.

Answered: 1 week ago