Write a client and a server that permit client to execute

Assignment Help Basic Computer Science
Reference no: EM131056900

Write a client and a server that permit the client to execute arbitrary shell commands on the server host. (If you don't implement any security mechanism in this application, you should ensure that the server is operating under a user account where it can do no damage if invoked by malicious users.) The client should be executed with two command-line argument
After connecting to the server, the client sends the given command to the server, and then closes its writing half of the socket using shutdown(), so that the server sees end-of-file. The server should handle each incoming connection in a separate child process (i.e., a concurrent design). For each incoming connection, the server should read the command from the socket (until end-of-file), and then exec a shell to perform the command. Here are a couple hints:

See the implementation of system() in Section 27.7 for an example of how to execute a shell command.
By using dup2() to duplicate the socket on standard output and standard error, the execed command will automatically write to the socket.

Reference no: EM131056900

Questions Cloud

What is the ph of the new solution : A solution is made up by combining 50 mL of a 0.58 M acetic acid solution and 50 mL of a 2.18 M sodium acetate solution. What is the pH of the new solution?
Range of frequencies and wavelengths : Brookhaven National Laboratory (BNL) recently constructed the National SynchrotronLight Source II (NSLS-II), which provides the world's brightest coherent x-rays for studying materials and biological systems. Beamline 17-ID-2, the Macromolecular C..
Write a paper in which you identify the health care setting : To complete this Application Assignment, write a 3-page paper in which you identify the health care setting (or context) in which each of the four specific systems you selected is used.
How should companies address the problem of public fear : What are the moral issues in this case? What ideals. obligations, and consequences must Carla Lombard consider? What rights. if any are at stake? Will it make a difference whether Carla adopts a Kantian approath or a utilitarian approach to this s..
Write a client and a server that permit client to execute : See the implementation of system() in Section 27.7 for an example of how to execute a shell command. By using dup2() to duplicate the socket on standard output and standard error, the execed command will automatically write to the socket.
The electromagnetic spectrum : Watch the video titled "What Are Gamma Rays?" (1 min 39 sec) under the Gamma Rays terms section of the Science Corner.
Innovative business concept and want to start a new business : Description: With members of your group you are to develop an innovative business concept and want to start a new business venture and you are looking for funding. In order to secure funding you are required to present your innovation and develop ..
Question regarding the molecules location : Two molecules, one polar the other anionic, walk into a bar and have seats equidistance away from you on your right and left. If you are a polar molecule, which of the two molecules are you more attracted to and why? Also, explain why the molec..
Describe marxs theory of the falling rate of profit : Describe Marx's theory of the falling rate of profit and explain its relation to his value theory. Additional RequirementsMin Pages: 2Other Requirements: 1000 words, mla citation.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Create a mount point on the current file system

In Fedora Core 4, if you need to create a mount point on the current file system, you first create a directory in the file system using the ____ command

  We enhance a machine making all floating-point instructions

Suppose we enhance a machine making all floating-point instructions run five times faster. If the execution time of some benchmark before the floating-point enhancement is 10 seconds, what will the speedup be if half of the 10 seconds is spent exe..

  Draw a pda for the language

Draw a PDA for the language L over {0,1} consisting of strings with an equal number of 0's and 1's. So 010011 would be in this language. Next draw a DFA recognizing 0?1?. Use the algorithm from class to draw a PDA for the intersection of these two..

  Pseudocode description of a function that uses only d and q

Suppose you have a deque D containing the numbers (1,2,3,4,5,6,7,8), in this order. Suppose further that you have an initially empty queue Q. Give a pseudo-code description of a function that uses only D and Q (and no other variables or objects) and ..

  Write a function to simulate the game show problem

Write a function to simulate the game show problem. Your function should randomly select locations for the prizes, select a door at random chosen by the contestant, and then determine whether the contestant would win or lose by sticking with the o..

  More of the databases for computer networks

Using one or more of the databases for Computer Networks and Cyber Security, search for peer-reviewed journal articles about the communication theory or by the name of the person you selected to see if communication research on that theory has be..

  Use this information to find a tighter bound on p

If X is a non-negative random variable with E(X) = ?, then Markov's inequality tells us that for every a, P(X ? a) ? ?/a. As we saw in class, this bound is sometimes very loose. In this problem we'll look at a situation in which extra information ..

  Briefly the differences in output of the various versions

Use the "time" option on linux to capture the experimental run-time of the various versions of your algorithms, on various sizes of inputs. The sizes to report are 50 elements, 50 commands; 50 elements 1000 commands; 1000 elements 1000 commands; a..

  Diversity of approaches

Diversity of Approaches

  Creating the critical path

Create a graphic rendering of the critical path for your project using Visio or its open source alternative software. Note: The graphically depicted solution is not included in the required page length.

  Data structures are supported by the library

What data structures are supported by the library? What types of data are recommended for use with each data structures object? Which classes contain which data structures, and what methods does the library provide?

  Code works and does what it is suppose to do

Please make sure the code works and does what it is suppose to do. I keep getting answers on my other assignments that were copy and pasted from god knows where and had nothing to do with the assignment instructions.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd