Question

In: Computer Science

I have this projegt I will use asp.net wHAT PART CAN USE TO COMPLETE THE PROGET...

I have this projegt I will use asp.net wHAT PART CAN USE TO COMPLETE THE PROGET

For this project in the (Advanced Computer Networks) course, you may pick a system/language you like, design the project, implement it, and write a project report about it.

This project is related with the Readers and writers. Two types of users, Readers and Writers, can access a shared file. The file is allowed to be read by many readers simultaneously, but to be written by a single writer at a time when no reader is reading.

In this project, you are asked to solve the readers and writers problem by using the clientserver model and a kind of communication facility. Your program consists of several clients (readers and writers), a file access authorization server, and a shared file bank server. Clients may read/write different files or share a single file.

Before a client being able to access a file from the shared file bank server, it must first communicate with the authorization server to get a ticket (an encrypted permission which can be decrypted only by the shared file bank server). The file access authorization server receives requests from clients and manipulates up to N different files. The request message involves the following fields: the ID of the client, the type of the request (R/W), and the name of the file that the client wants to access. A transaction of accessing a file from a client is as follows:

• send REQ Message: request to the authorization server

• block_receive: waiting for a ticket

• send read/write (data) and ticket: request to the file bank server

• block_receive: waiting for data or ACK

• send REL Message: release to authorization server

• loop for certain times

You should test your program by different cases. For example, suppose your system manipulate five files A, B, C, D and E. One possible test case is to start with 30 clients that randomly access (with 30 percent of writers) a randomly selected file. Each client repeat 100 times. You should design at least 5 different test cases and you should use at least 3 computers to run your project.

Project Report: the report is a short report (2-4 pages) for what your project will be. It should contain a problem description and motivation, a description of the design of your solution, a description of your implementation, and an evaluation of how well your system solved the original problem.

Solutions

Expert Solution

/* I have written code for Reader Writer client server in C programming */
/* server */
#include<stdio.h>
#include<string.h>
#include<netinet/ip.h>
#include<netinet/in.h>
#include<sys/socket.h>
#include<unistd.h>
main()
{
        struct sockaddr_in v,v1;
        int sfd,nsfd,len,i;
        char a[100];
        sfd=socket(AF_INET,SOCK_STREAM,0);
        perror("sfd");
        v.sin_family=AF_INET;
        v.sin_port=htons(3000);
        v.sin_addr.s_addr=inet_addr("0.0.0.0");
        len=sizeof(v);

        bind(sfd,(struct sockaddr *)&v,len);

        listen(sfd,5);
        perror("listen");

        nsfd=accept(sfd,(struct sockaddr *)&v1,&len);
        perror("accept");
        while(1)
        {
                read(nsfd,a,sizeof(a));
                printf("%s\n",a);
                for(i=0;a[i];i++)
                  if(a[i]>='a' && a[i]<='z')
                  a[i]=a[i]-32;
                /*scanf("\t\t%s",a);*/
                gets(a);
                write(nsfd,a,strlen(a)+1);
        }
}


/ * client */
#include<stdio.h>
#include<sys/socket.h>
#include<netinet/in.h>
#include<string.h>
#include<stdlib.h>
int main(int argc ,char* argv[])
{
        int sfd, nsfd;
        char a[256];
        struct sockaddr_in var;
        socklen_t l;
        if((sfd = socket(AF_INET, SOCK_STREAM, 0))==-1)
        perror("socket");
        var.sin_family = AF_INET;
        var.sin_port = htons(atoi(argv[1]));
        var.sin_addr.s_addr = INADDR_ANY ;//net_addr("0.0.0.0");
        l = sizeof(var);
        connect(sfd, (struct sockaddr *)&var, l);
        perror("connect");
        printf("message :");
        while(1){
                scanf("%s", a);
                write(sfd, a, strlen(a)+1);
                sleep(1);
                read(sfd, a, sizeof(a));
                printf("%s\n", a);
        }
}


Related Solutions

C# ( asp.net ) 2019 Visual Studio I have a dropdown where you can select (...
C# ( asp.net ) 2019 Visual Studio I have a dropdown where you can select ( integer, string, date ) After selecting the desired dropdown option, user can input a list of inputs. For example; for integer: 2,5,7,9,1,3,4 And then , I have a 'sort' button Can you please help me with the code behind for sorting them( For integer, string, and date ) Thank you.
I HAVE ALREADY CORRECTLY COMPLETED PART A AND B PLEASE COMPLETE PART C ONLY Part A...
I HAVE ALREADY CORRECTLY COMPLETED PART A AND B PLEASE COMPLETE PART C ONLY Part A In late 2020, the Nicklaus Corporation was formed. The corporate charter authorizes the issuance of 6,000,000 shares of common stock carrying a $1 par value, and 2,000,000 shares of $5 par value, noncumulative, nonparticipating preferred stock. On January 2, 2021, 4,000,000 shares of the common stock are issued in exchange for cash at an average price of $10 per share. Also on January 2,...
C# ( asp.net ) 2019 visual studio I have a dropdown option. If I choose "date"...
C# ( asp.net ) 2019 visual studio I have a dropdown option. If I choose "date" option, I get to enter list of dates like 02/08/1990, 06/14/1890 in (mm/dd/YYYY) format. How can I sort these dates in ascending order?. Can you provide me some code. Thank you
I have figured out the SPSS part, can someone answer the questions? Use SPSS to answer...
I have figured out the SPSS part, can someone answer the questions? Use SPSS to answer the following: Create a histogram to organize the following distributions of scores. How does the distribution look like? Normal curve, positive and negatively skewed? Construct a grouped frequency distribution table. Show the Mean Median and standard deviation of the data in your SPSS output. How many scores lie within the class interval that is equivalent to 100% Scores: 28 54 65 53 81 45...
(I already have part A but still still include it anyways so you can use its...
(I already have part A but still still include it anyways so you can use its data to solve for parts B and C. Chemical energy is released or absorbed from reactions in various forms. The most easily measurable form of energy comes in the form of heat, or enthalpy. The enthalpy of a reaction can be calculated from the heats of formation of the substances involved in the reaction: ΔH∘rxn=ΔH∘f(products)−ΔH∘f(reactants) Entropy change, ΔS∘, is a measure of the number...
Complete Part I of this assignment first, if you have not done so, because it provides...
Complete Part I of this assignment first, if you have not done so, because it provides guided practice on questions similar to the questions in Part II here. Check out the “Important Resources and Assignment Guides” in the Modules section on Canvas to see how to properly show your math work. There are also examples of the APA-style tables and graphs (figures) for your reference. Your submitted assignment must be in Word format, with a clear answer typed out for...
I have to use a sentinel while loop to complete the following task in a java...
I have to use a sentinel while loop to complete the following task in a java program, I want to see how this is executed so I can better understand how the sentinel while loop works. Thank you! Convert Lab 10 from a counter controlled WHILE loop to a sentinel WHILE loop. Do the following: Prompts the user to enter a grade or a -1 to quit. IF the user entered a -1 THEN Display a message that the User...
Assignment Direction: Complete Part I of this assignment first, if you have not done so, because...
Assignment Direction: Complete Part I of this assignment first, if you have not done so, because it provides guided practice on questions similar to the questions in Part II here. Check out the “Important Resources and Assignment Guides” in the Modules section on Canvas to see how to properly show your math work. There are also examples of the APA-style tables and graphs (figures) for your reference. Your submitted assignment must be in Word format, with a clear answer typed...
I have to complete a template for pathophysiology , can someone tell me the pathophysiology of...
I have to complete a template for pathophysiology , can someone tell me the pathophysiology of pain. This is for a pathophysiology class
Part I:  How have you noticed marketing has changed over time? Please use examples. Part II: What...
Part I:  How have you noticed marketing has changed over time? Please use examples. Part II: What are some strategies that marketers can use to determine price? Which method do you think is the most useful? Why?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT