Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this assignment you are required to follow the Unix domain server and client example done in the classroom. After this point, you need to

In this assignment you are required to follow the Unix domain server and client example done in the classroom. After this point, you need to setup the server in a way that it will process the data sent by the client and send back the processed data. You must read at least two set of data, and send back at least a piece of information. For instance, client might send two numbers and the server will send the summation back. This is only an example, please do something a little more complicated. I do not want to see same operation over and over again in the assignments. You can use scanf and printf with dup2 to obtain numbers. Alternatively, you could read the text and use sscanf and sprintf. You could also perform text based operations. It is up to you. You must perform all error checks. Submit two C files. Here is an example made in class.image text in transcribed

1 2 3 4 5 6 7 #include #include #include #include #include #include 00 NOW int main() { // *** 1. Create socket int sock = socket AF_UNIX, SOCK_STREAM, 0); 1 #include 2. #include #include #include #include #include #include 8 #include 9 10 int sock; 11 12 void interrupt(int sig) { 13 close (sock); 14 unlink("16.tmp"); 15 printf ("Exiting... "); 16 exit(0); 17 3 18 1 19 int main() { 20 21 1/ *** 1. Create socket 22 sock = socket (AF_UNIX, SOCK_STREAM, 0); 23 24 signal (SIGINT, Sint upt); 25 signal (SIGTERM, Sinterrupt); // *** 2. Connect struct sockaddr_un addr/* = {AF_UNIX, "16. tmp"}*/; addr.sun_family = AF_UNIX; strcpy(addr.sun_path, "16.tmp"); 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 int err = connect sock (struct sockaddr*) Saddr, sizeof addr if 0) { if incoming == 0) break; int err = bind sock, (struct sockaddr Saddr, sizeof addr 34

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

DB2 11 The Ultimate Database For Cloud Analytics And Mobile

Authors: John Campbell, Chris Crone, Gareth Jones, Surekha Parekh, Jay Yothers

1st Edition

1583474013, 978-1583474013

More Books

Students also viewed these Databases questions

Question

Discuss the key people management challenges that Dorian faced.

Answered: 1 week ago

Question

How fast should bidder managers move into the target?

Answered: 1 week ago