Concept explainers
Can anyone help me with basic client-server interaction using TCP sockets in network
The ideas is have 4 choice: Add record, Search Age Range, Search graducation year, and Terminate.
In opition 1, it should collect all the data to the text file, in opition 2, it should search for age range from the text file. in opition 3, it should search the graducation year from the text file and if the year is not there it should print record not found. And opition 4, the client should close the connection and terminate.
studentRecord.txt:
John,Doe,24,Computer Science,2023
Jane,Doe,22,
Charles,Babbage,21,Math,2022
George,Bool,25,Math,2023
Marie,Curie,26,Chemistry,2023
I know this isn't enough but I want to understand about the client-server interaction using socket interface. So please try to make it simple for me. And feel free to use extra c file and makefile to run it from jupyterhub.
that would be helpful. Thanks.
Step by stepSolved in 3 steps
- Please write in C++ and run in linux. This assignment is about fork(), exec(), and wait() system calls, and commandline arguments. Write two C++ programs, to be named parent.cc and child.cc and compiled into executable parent and child, respectively that, when run, will work as follows: parent takes in a list of gender-name pairs from the commandline arguments creates as many child processes as there are in the gender-name pairs and passes to each child process a child number and a gender-name pair waits for all child processes to terminate outputs “All child processes terminated. Parent exits.” And terminates. child receives a child number and one gender-name pair arguments from parent outputs “Child # x, a boy (or girl), name xxxxxx.” Note: content of output depends on data received from parent Sample run To invoke the execution: >parent girl Nancy boy Mark boy Joseph parent process does the following: outputs “I have 3 children.” -- Note: the number 3…arrow_forwardWrite a function in python named "write_anagrams", that accepts a dictionary of anagrams and a filename. Write each set of anagrams out to a record in a CSV file with the specified name. The first word on each line should be the sorted word, followed by a count of the of the anagrams that include the same characters, e.g.: key,anagram_1,[anagram_2, ...] For example, there are 6 different words in words.txt that are anagrams for the key "aet": aet,aet,ate,eat,eta,tae,tea If any errors occur, print a detailed error message without crashing.arrow_forwardjava program For this question, the server contains the id, name and cgpa of some Students in a file. The client will request the server for specific data, which the server will provide to the client. Server: The server contains the data of some Students. For each student, the server contains id, name and cgpa data in a file. Here's an example of the file: data.txt101 Saif 3.52201 Hasan 3.81.... Create a similar file in you server side. The file should have at least 8 students. The client will request the server to provide the details (id, name, cgpa) of the Nth highest cgpa student in the file. If N's value is 1, the server will return the details of the student with the highest cgpa. if N's value is 3, the server will return the details of the student with the third highest cgpa. If N's value is incorrect, the server returns to the client: "Invalid request". Client: The client sends the server the value of N, which is an integer number. The client takes input the value of N…arrow_forward
- write in c++Write a program that would allow the user to interact with a part of the IMDB movie database. Each movie has a unique ID, name, release date, and user rating. You're given a file containing this information (see movies.txt in "Additional files" section). The first 4 rows of this file correspond to the first movie, then after an empty line 4 rows contain information about the second movie and so forth. Format of these fields: ID is an integer Name is a string that can contain spaces Release date is a string in yyyy/mm/dd format Rating is a fractional number The number of movies is not provided and does not need to be computed. But the file can't contain more than 100 movies. Then, it should offer the user a menu with the following options: Display movies sorted by id Display movies sorted by release date, then rating Lookup a release date given a name Lookup a movie by id Quit the Program The program should perform the selected operation and then re-display the menu. For…arrow_forwardCreate an Ordered Doubly Linked List in C++. Remember that an ordered Linked List is one where inserts automatically place a new node so that all the nodes retain a certain order. This list should be templated where items should be in "ascending" order (i.e., if it is a list of numbers, it should be of order of least to greatest).arrow_forwardWrite a c++ program that reads in input commands related to a queue with no more than ten elements and performs the specified operations. Note that you should create three files, one for the main, one for Queue.h, and one for Queue.cpp. Those commands are: 'E', which will be followed by a number. You should enqueue that number 'D', which will dequeue the value from the front of the queue and print it, followed by a new line 'K'. which will peek at the value at the front of the queue and print it, followed by a new line 'Q', which will quit the program You can assume that all the input is valid.arrow_forward
- Problem: Implement a part of functionality for the Netflix DVD queue. It's a service that allows a user to create a list of desired movies and then sends DVDs with movies on top (what we called head in our lectures) of this list to the subscriber one at a time. A subscriber should be able to create a list of desired movies and manipulate the order in a movie queue in their account. Your program will implement some of the desired functionality by storing the list of movie titles in a linked list. You are provided with the following files available in the "Downloadable files" section: MovieList.h contains a class declaration for the class that represents a list of movies. top refers to the head position of a list and bottom refers to the tail or end position of a list. Driver.cpp contains the main function you can use to test your implementation. *** NOTE: Please do not change any of the function names since our automated test script calls those functions. Changing function names or…arrow_forwardYou are creating a database for storing information for a Netflix like service. The database stores movies with id, title, filename and TV shows with id, title. TV Shows have episodes. Each episode has a corresponding TV show, a season id, an episode id, title, filename. Some episodes have a next episode (i.e. the episode that will automatically start showing once the user finishes watching the current episode!). The database also stores users, each user has an id, username, password. Users may watch zero or more movies, zero or more TV show episodes. For each movie or episode, the database stores a watch time value for each user, indicating how many minutes the user watched that movie or show. Finally, the database stores which movie appears similar to which other movie for a given user (to be able to make recommendations). Construct an E-R diagram (based on a Chen's model) to represent the above requirements. Make sure you include all appropriate entities, relationships, attributes,…arrow_forwardWrite a program in c++ and make sure it works, that reads a list of students (first names only) from a file. It is possible for the names to be in unsorted order in the file but they have to be placed in sorted order within the linked list.The program should use a doubly linked list.Each node in the doubly linked list should have the student’s name, a pointer to the next student, and a pointer to the previous student. Here is a sample visual. The head points to the beginning of the list. The tail points to the end of the list. When inserting consider all the following conditions:if(!head){ //no other nodes}else if (strcmp(data, head->name)<0){ //smaller than head}else if (strcmp(data, tail->name)>0){ //larger than tail}else{ //somewhere in the middle} When deleting a student consider all the following conditions:student may be at the head, the tail or in the middleBelow, you will find a sample of what the file looks like. Notice the names are in…arrow_forward
- Implement a city database using a BST to store the database records. Each database record contains the name of the city (a string of arbitrary length) and the coordinates of the city expressed as integer x- and y-coordinates. The BST should be organized by city name. Your database should allow records to be inserted, deleted by name or coordinate, and searched by name or coordinate. Another operation that should be supported is to print all records within a given distance of a specified point.Collect running-time statistics for each operation. Which operations can be implemented reasonably efficiently (i.e., in O(log n) time in the average case) using a BST? Can the database system be made more efficient by using one or more additional BSTs to organize the records by location?arrow_forwardPython decorators can be used in Django in order to avoid duplication of code in view functions. For instance, consider the following definition of a decorator that is then applied to a view function. This code has three bugs: 01: def fetch_author (view_func) : 02: 03: 04: 05: 06: 07: 08: def wrapper (request, *args, **kwargs) : return view_func 09: 10: @fetch_author 11: def books_new (request) : 12: 13: 14: 15: 16: 17: } books = Book.objects.filter (authors _in= [author], year_ _gte="2015") context = { try: author = Author.objects.get (id-request. GET ["author_id"]) view_func (request, author, *args, **kwargs) except Author. Does NotExist: return bad_request (request, Author.DoesNotExist) Line 02 Line 05 Line 08 return render (request, "books-recent.html", context) Line 11 Identify the three lines which contain the three bugs: Line 12 Line 17 "title" : "New books", "books" books,arrow_forwardYou are to write a program, in $ ./Rainbow Passwords.txt Implementing a rainbow table where the file Passwords.txt contains a list of possible passwords. The password file contains a password per line, as in the provided words file and consists of strings of printable characters. Any password used must be taken from this file, so the only stored hash information needs to relate to those entries in the file. The program is used to find pre-images for given hash values. Rainbow tables can be used to solve pre-image problems for hash functions. At the simplest level they can simply be a list of hash values and the corresponding pre-images, often from some dictionary. This can be expensive in terms of storage space however, and a more efficient way of identifying pre-images involves the use of the hash function and reduction functions. First step The process is as follows: 1. Read in the list of possible passwords. Report on the number of words read in. 2. For each previously unused word…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education