Write two c++ programs to implement a distributed version of a multithreaded Huffman decompressor using the one in project 1 The server program The user will execute this program using the following syntax: ./exec_filename port_no < input_filename where exec_filename is the name of your executable file, port_no is the port number to create the socket, and input_filename is the name of the file with the alphabet's information. The port number will be available to the server program as a command-line argument. The server program receives from STDIN the alphabet's information (using input redirection). The input file has multiple lines, where each line contains information (character and frequency) about a symbol from the alphabet. The input file format is as follows: A char representing the symbol. An integer representing the frequency of the symbol. Example Input File: E 3 G 3 F 1 H 2   Given the previous input file, the expected output for the server program is: Symbol: G, Frequency: 3, Code: 0 Symbol: F, Frequency: 1, Code: 100 Symbol: H, Frequency: 2, Code: 101 Symbol: E, Frequency: 3, Code: 11     The client program: The user will execute this program using the following syntax: ./exec_filename hostname port_no < compressed_filename where exec_filename is the name of your executable file, hostname is the address where the server program is located, port_no is the port number used by the server program, and compressed_filename is the name of the compressed file. The hostname and the port number will be available to the client as command-line arguments. The client program receives from STDIN (using input redirection) m lines (where m is the number of symbols in the alphabet). Each line of the compressed file has the following format: A string representing the binary code of the symbol. A list of n integers (where n is the frequency of the symbol) representing the positions where the symbol appears in the message. Example Compressed File: 11 1 3 5 0 0 2 4 101 6 8 100 7 Given the previous compressed, the expected output is: Original message: GEGEGEHFH Notes: You can safely assume that the input files will always be in the proper format. You must use the output statement format based on the example above. For the client program, you must use POSIX Threads and stream sockets. You must use multiple processes (fork) and stream sockets for the server program. project 1 code: https://replit.com/@jacksmith-2023/PA1 input and output usage: ./server 8080 < input1.txt Input for the Server: E 3 G 3 F 1 H 2   usage: ./client local host 8080 < compressed1.txt Input for the Client: 11 1 3 5 0 0 2 4 101 6 8 100 7   Expected Output Symbol: G, Frequency: 3, Code: 0 Symbol: F, Frequency: 1, Code: 100 Symbol: H, Frequency: 2, Code: 101 Symbol: E, Frequency: 3, Code: 11 Original message: GEGEGEHFH

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Topic Video
Question

Include the code to any h files used

Write two c++ programs to implement a distributed version of a multithreaded Huffman decompressor using the one in project 1

The server program

The user will execute this program using the following syntax:

./exec_filename port_no < input_filename

where exec_filename is the name of your executable file, port_no is the port number to create the socket, and input_filename is the name of the file with the alphabet's information. The port number will be available to the server program as a command-line argument.

The server program receives from STDIN the alphabet's information (using input redirection). The input file has multiple lines, where each line contains information (character and frequency) about a symbol from the alphabet. The input file format is as follows:

A char representing the symbol.

An integer representing the frequency of the symbol.

Example Input File:

E 3

G 3

F 1

H 2

 

Given the previous input file, the expected output for the server program is:

Symbol: G, Frequency: 3, Code: 0

Symbol: F, Frequency: 1, Code: 100

Symbol: H, Frequency: 2, Code: 101

Symbol: E, Frequency: 3, Code: 11

 

 

The client program:

The user will execute this program using the following syntax:

./exec_filename hostname port_no < compressed_filename

where exec_filename is the name of your executable file, hostname is the address where the server program is located, port_no is the port number used by the server program, and compressed_filename is the name of the compressed file. The hostname and the port number will be available to the client as command-line arguments.

The client program receives from STDIN (using input redirection) m lines (where m is the number of symbols in the alphabet). Each line of the compressed file has the following format:

A string representing the binary code of the symbol.

A list of n integers (where n is the frequency of the symbol) representing the positions where the symbol appears in the message.

Example Compressed File:

11 1 3 5

0 0 2 4

101 6 8

100 7

Given the previous compressed, the expected output is:

Original message: GEGEGEHFH

Notes:

You can safely assume that the input files will always be in the proper format.

You must use the output statement format based on the example above.

For the client program, you must use POSIX Threads and stream sockets.

You must use multiple processes (fork) and stream sockets for the server program.

project 1 code:
https://replit.com/@jacksmith-2023/PA1

input and output

usage: ./server 8080 < input1.txt

Input for the Server:

E 3

G 3

F 1

H 2

 

usage: ./client local host 8080 < compressed1.txt
Input for the Client:

11 1 3 5

0 0 2 4

101 6 8

100 7

 

Expected Output

Symbol: G, Frequency: 3, Code: 0

Symbol: F, Frequency: 1, Code: 100

Symbol: H, Frequency: 2, Code: 101

Symbol: E, Frequency: 3, Code: 11

Original message: GEGEGEHFH

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Knowledge Booster
Instruction Format
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education