Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Write a socket
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 3 steps with 10 images
Knowledge Booster
Similar questions
- This question relates to Socket Programming in C. From the code shown in Figure 4write the part of the server code where:i) A socket is created.ii) The properties of the created socket are filled in. Use the last 4 digits of yourstudent ID (9 digit ID) as port number.iii) The created socket is associated with its properties using the appropriate system calland parameters.iv)Take the last digit of your student ID (9 digit ID); if it is an odd number you are going to writethe code for a TCP server from the listening socket and all the steps of code after iii)to allow the server to communicate with one client by receiving a request from theclient and sending the answer “I got your request!”. If the last digit of your studentID (9 digit ID, 123456789) is an even number, you are going to write all the steps of code from iii) for a UDPserver to communicate with one client by receiving a request from the client andsending the answer “I got your request!”.Notes:1. Inside the code you must add…arrow_forwardSolve the problem in C++ (HexFormatException)Implement the hex2Dec function in Programming Exercise 16.1 to throw a HexFormatException if the string is not a hex string .Define a custom exception class named HexFormatException. Write a test program that prompts the user to enter a hex number as a string and displays the number in decimal. If the function throws an exception, display "Not a hex number".arrow_forward2 Project Specification In this project, you are required to do socket programming in C language (Linux environment) to implement a pair of client and server that can achieve simple password verification to indicate the current market value of the stock. Your client will send a pair of username and password to your server and your server will verify whether the pair of username and password is legitimate or not for retrieving the stock value. Assume the only legitimate pairs of usernames and passwords that will be accepted by your server are as follows. Username Password Stock Value welpa23e ghqwo31a lcid mrvl snap cl1 bro CVS tyjli14d rjwqe83f gnmds28z rhkt187c 13.93 41.23 10.21 85.09 56.43 91.34 Table 1: Content of StockFile.txt Specifically, your client and server programs entail to achieve the following requirements: 1. Your client program needs to take two arguments that specify the name of server and the port that it is trying to connect to. Your program for server needs to take…arrow_forward
- 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: C,…arrow_forwardC++ coding assigment 5 I am having trouble to get my coding working because I addressBook.cpp and addressbook.h is not working well with my Person so I need help figure out the problem because I have don't know how to fix my coding so that both person and addressbook work for the main. remainder: due not type in java. Make sure to type c++ in different files like Main.cpp, Person.cpp, Person.j, AddressBook.cpp, and AddressBook.h This small project is geared to test your understanding of File IO. AddressBook Exception Create an AddressBookException class that you can use to throw exceptions in your address book. Your class should have a constructor that will allow you to set the particular message that corresponds to the error. You should use your custom exception class to throw an error in the findPerson method if the person being searched for cannot be found, in the getPerson method if the AddressBook is empty. You should also throw an error any time that the addressbook file that…arrow_forwardThis code is only for python. this is a game- transfer rings there are 3 problems which you are solving: A: failed transfer - make sure the progam dont take more than what the user inputed by raising an exceptionB: codE the trade_money function C: if sonic doesnt have as much as the user inputed, there will be an error pop up 'ERROR TRADE FAILED'. make it so the progam can run normally rather than turning it down. CODE: class user:def __init__(self, name, initial_money):self.name = nameself.money = initial_moneydef give_money(self, amount):self.money = self.money + amountdef take_money(self, amount):# Part A: Raise an exception as appropriateself.money = self.money - amountdef print_users(users):total_money = 0for user in users:print(f'{user.name:s} has {user.money:d} rings')total_money = total_money + user.moneyprint(f'There are a total of {total_money:d} rings')# B: code the trade_money functionsonic = user('sonic', 80)tails = user('tails', 20)print_users([sonic,…arrow_forward
- No restriction exists on the number of arguments permitted in a catch block.arrow_forward"In PHP, reusable code can be inserted into every module using which function?" include() call() copy() insert() QUESTION 12 "Is software development testing phase, the first test is done by a developer after changing code or creating new code. What do you call this phase of testing?" Development test Unit test System test Integration test QUESTION 13 "In PHP, if an exception is not caught, a fatal error will be issued with a(n). Not found System Uncaught Exception Error message." QUESTION 14 Which PHP function replaces some characters with some other characters in a string or arrays? find_replace() str_replace() changestr() replace()arrow_forwardWrite a PYTHON code with at least 2 functions (one should call the other). The function which is called by the first function should also be able to be called directly. Execute these functions with various parameters such that you can demonstrate the following: Each function should have some debug code so you can trace calls to the functions and activity within the functions. Each should handle at least 2 types of exceptions (both shouldn't handle the same exceptions). The function called by the first one should, at some point, generate a division by zero error, but should NOT handle this error. The function that calls the division by zero function should handle a division by zero error. Catch one error and raise a different one. Have some finally code (perhaps with some debugging output) Demonstrate & explain: call the division by zero function both from your main program and from the other function. show that the exception isn't handled by the function itself but by the other…arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY
Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON
Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education
Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY