universidad de las amÉricas, a.c. ciudad de méxico · 2015-02-04 · universidad de las...

25
UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México Manual de Prácticas SC 471 CLIENT / SERVER SYSTEMS Otoño 2007

Upload: others

Post on 13-May-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México · 2015-02-04 · UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México Manual de Prácticas SC 471 CLIENT / SERVER SYSTEMS

UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México

Manual de Prácticas

SC 471

CLIENT / SERVER SYSTEMS

Otoño 2007

Page 2: UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México · 2015-02-04 · UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México Manual de Prácticas SC 471 CLIENT / SERVER SYSTEMS

Bachelor of Science in Computer Information System

SC-471 CLIENT/SERVER SYSTEMS MARTES Y JUEVES

Note: The sessions with Partial, Middle Semester or Final Evaluation are marked in gray.

DATE SESSIÓN THEME P 1 1. Introduction. Appropriate models for client/server. 2 Systems of support to decisions. 3 Interactive applications.

Ju 23 Ago 4 Practice 1. Comunication through Sockets √ 5 Practice 1. Comunication through Sockets √ 6 Practice 1. Comunication through Sockets √

7 2. Client/server Systems Design 2.1 Methodology for the develop of structured systems Client/Server

8 2.2 Structutred Design 2.3 Object-oriented technology

9 2.4 CASE Tools for development of Client/server Systems . Ju 13 Sep 10 Practice 2. Client Server √

11 Practice 2. Client Server √ 12 Practice 2. Client Server √

13 3. Fullfilment of Client/server Systems. 3.1 Client/Server Applications.

14 3.2 Qualitative design vs Quantitative.

15 3.3 Work load. 3.4 Performance Requirements.

16 3.5 Physical and logics limitations. 3.6 Other aspects.

17 4. Data Base distributed. 4.1 Concurrence of processes. 4.2 Design and Structure.

18 MID TERM EXAM

19 4.2.1 Authonomy. 4.2.2 Dependence.

20 4.2.3 Functions and modules cooperation.

21 4.3 Distributed systems problems. 4.3.1Consulting process.

22 4.3.2 Update 4.3.3 Recovery

23 5. Client/server application structure. 5.1 OSI Model

24 5.2 Sockets 5.4 CASE Tools

25 5.3 RPC Ju 08 Nov 26 Practice 3. Remote Procedure Calling Mechanism √

27 Practice 3. Remote Procedure Calling Mechanism √ 28 Practice 3. Remote Procedure Calling Mechanism √

29 Thin/Thick Client Intranet/Extranet

30 Security Ma 27 Nov 31 Practice 4. WEB Servers: CGI/Perl √

32 Practice 4. WEB Servers: CGI/Perl √ 33 Practice 4. WEB Servers: CGI/Perl √ 34 FINAL EXAM

Page 3: UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México · 2015-02-04 · UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México Manual de Prácticas SC 471 CLIENT / SERVER SYSTEMS

CONTENT Presentation ........................................................................ 1 Practice 1 ........................................................................ 4 Comunication through Sockets Practice 2 ........................................................................ 13 Client Server Practice 3 ........................................................................ 16 Remote Procedure Calling Mechanism (RPC) Practice 4 ........................................................................ 19 WEB Servers: CGI/Perl

Page 4: UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México · 2015-02-04 · UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México Manual de Prácticas SC 471 CLIENT / SERVER SYSTEMS

PRESENTATION

Welcome to your practices of Client/Server!

We are happy to be able to participate with you in this practical experience, in which you will have chance to incorporate the teoric-practic knowledges that you are acquaring in the subject of Client/Server.

This practices manual will serve you to consolidate your knowledge, to apply all the tools that were seen in class as well as, to acquire abilities and skills.

GENERAL MISSION There are many points of views about the way of doing the data processing, although many people who gives their opinion, say that we are in the middle of an evolution process that will be longer for some years and that will change the way we obtain and use the electronic storage information.

The Client/Server model has the necessary characteristics for bringing this structure, independent of the size and complex of the operations of their public or private organizations and consequently it has an important role in this evolution process.

In this subject Client Server Systems, wih SC-471 key, the Client/Server models are studied, the function of them, the structure of this kina of application, and distributed data base, so, in this manual are included practices to reaffirm the teoric knowledges acquired during class.

METHODOLOGY

The course is developed within the framework of active pedagogy and estimates an intense work on the part of each student inside and outside of the classroom. Before each session the student will have to investigate the subjects to treat in class to be able to make contributions.

In the class sections reading controls will be carried out, doubts solution and solution to concrete difficulties.

As each student is the creator of his learning, the professor as an orientation of the course will try to facilitate this process, indicating material, clarifying concrete facts and helping to create an academic curiosity and investigation atmosphere.

Page 5: UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México · 2015-02-04 · UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México Manual de Prácticas SC 471 CLIENT / SERVER SYSTEMS

ABILITIES AND PROFESSIONAL VALUES TO DEVELOP DURING THE COURSE:

ABILITIES:

Organization: Capacity to plan, to execute and later to articulate a set of activities within a plan or project with specific objectives, within time limits, space and with resources that can exist previously or that must be obtained

Team work: The ability to accept and to commit themselves with the responsibility to share and to receive information between the members of a people group for the search and to reach a common objective. Analysis: The capacity to examine an objective or a complex situation and to appreciate its constituent parts or elements and the relations between these. Communication: The ability to read different types from context with complete understanding to emit analyses on that content. Ability for writing letters, information, tests in correct Spanish with the necessary order and conceptual clarity for an easy understanding on the part of the reader. Ability to communicate verbally in different contexts; dialogues, presentation to a group, speech, with order, clarity and correction of content and with the appropriate verbal presentation. Under pressure work: The capacity for not losing calm, during a stress situation as well as to make with standards of quality and time of the demanded work. Information managment: Capacity to define the relevance and applicability of data and information.

Permanent individual learning: The ability to define the area or subject of its interest; to look for the affluent information is in texts, articles, audio-visual material, Internet, other people, to plan, to organize and to fulfill study spaces.

VALUES:

Responsibility: To give account of your own acts and of what you are entrusted to. Integrity: To be intachable and consistent between which it is created, said and done.

Honesty: To come with honesty, rectitud and veracity in all the actions of the life. Intellectual Curiosity: To wish to extend the borders of the own knowledge.

Page 6: UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México · 2015-02-04 · UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México Manual de Prácticas SC 471 CLIENT / SERVER SYSTEMS

FOR THE DEVELOPMENT OF THE PRACTICES, YOU MUST TAKE INTO ACCOUNT THE FOLLOWING CONSIDERATIONS:

The present Manual it contains the practices necessary to carry out the experiences of learning of the matter Client/Server. It is necessary that you take the following considerations:

1. In the present manual, you will find real problems so that you apply to the concepts, tools and techniques seen in class. Previously some excellent theoretical knowledge will refresh.

2. They will be carried out in the software laboratory, in the stipulated dates in

the manual.

3. For the development of the practices, you will use specific tools for the implementation of networks as you will do it in the real life working for a company.

4. Permanently you will have your professor as an adviser.

5. Once solved the practices, the professor will ask for to a student to expose

the results. 6. The professor will put under discussion and analysis the results, doing

feedback.

7. In the later class to the practice, a student at random will present a summary of the previous class.

8. For the evaluation of the practice, the professor will take into account the

following criteria: Results and exhibition.

9. The practices will have like minimum 30% of the total evaluation of the course.

10. Finally I remember you to arrive puntual at the sessions, passed 10 minutes

the student won’t be able to enter to the classroom where the practice will be made and therefore will not have grade.

Page 7: UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México · 2015-02-04 · UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México Manual de Prácticas SC 471 CLIENT / SERVER SYSTEMS

LABORATORY PRACTICE

Licenciatura en Sistemas Computacionales y Administrativos SC-471 Client/Server Systems

Formation Area: Software Engineering

PRACTICE 1

Communication through Sockets

PLACE: Computation Laboratory

TIME:

6 HOURS

OBJECTIVE:

The objective of the first practice is to become familiar with the communications programs between processes through sockets.

INTRODUCTION First of all I will have to explain what is a socket. In a simple form, we can say that is the way of speaking with another computer. Being more specific, is a way of speaking with other computers using standard file descriptors of UNIX. In UNIX, all in and out actions are made writing or reading in one of these file descriptors, that are just an entire number, associated to an opened file, that can be a web connection, server or any other thing. Now as well, about the different kinds of sockets in Internet, there are many kinds, but we will only describe two of them – Flow Sockets (SOCK_STREAM) and Datagrams Sockets (SOCK_DGRAM). And “what is the difference between these two kinds of sockets?”, you could ask yourself. Here is the answer: Flow Sockets. They don’t have any mistake: For example, we send through the flow socket three objects "A, B, C", they will arrive to the destiny at the same order -- "A, B, C". These sockets use TCP ("Transmission Control Protocol") and this protocol gives us the order of the objects during the trtansmission. Datagrams Sockets. Thes use UDP (“User Datagram Protocol”), and do not need an accessible conection as the Flow Sockets – a data package will be made with information about its destiny and will be send outside wiithout a conection. Here could be more explained information about these two kinds of sockets, but I think this is enough to understand the basic concept of a socket.

Page 8: UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México · 2015-02-04 · UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México Manual de Prácticas SC 471 CLIENT / SERVER SYSTEMS

LABORATORY PRACTICE The purpose of this section is not to teach the structures concept on programming, but to teach how to use them in Sockets on C programming. If you don’t know what is an structure, my advice is to read a good C tutorial. By the moment, we can say that a structure is a kind of data which is conglomerate, this means that it could contain other kinds of data, that are all together in a group in just one kind defined by the program. The structures are used in the sockets programming to full information about addresses. The first of them is struct sockaddr, that contains socket information. struct sockaddr { unsigned short sa_family; /* familia de la dirección */ char sa_data[14]; /* 14 bytes de la dirección del protocolo */ }; But, another structure exists, struck sockaddr_in, which helps us to make reference to the elements of socket. struct sockaddr_in { short int sin_family; /* Familia de la Dirección */ unsigned short int sin_port; /* Puerto */ struct in_addr sin_addr; /* Dirección de Internet */ unsigned char sin_zero[8]; /* Del mismo tamaño que struct sockaddr */ }; Note. note can be formed with zeros using the functions memset() or bzero()) (See the examples below). The following struc ture is not commonly used but it is defined as a union. As it is possible to see when it is declared, for example "client" to be the type sockaddr_in, then is made client.sin_addr = (...). Anyway, here is the structure: struct in_addr { unsigned long s_addr; }; Finally, I believe that it’s better to talk about the hostent structure. In the example Client of Flows we can see how is used this structure, which we obtain information of the remote node.

Page 9: UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México · 2015-02-04 · UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México Manual de Prácticas SC 471 CLIENT / SERVER SYSTEMS

Here we can see its definition: struct hostent { char *h_name; /* El nombre oficial del nodo. */ char **h_aliases; /* Lista de Alias. */ int h_addrtype; /* Tipo de dirección del nodo. */ int h_length; /* Longitud de la dirección. */ char **h_addr_list; /* Lista de direcciones del nombre del */ /* servidor. */ #define h_addr h_addr_list[0] /* Dirección, para la compatibilidad con */ /* anteriores. */ }; This structure is defined in the file netdb.h. Conversions There are two kinds of bytes ordering: more significant bytes, and less significant bytes. This one is called “Arrangement Bytes for Webs”[5], some machines use this type of arrangement to keep its data internally. There are two kinds to which we will be able to turn: short and long [6]. Let’s imagine that we want turn a long Bytes Ordering variable for Nodes to one to Bytes Ordering for Webs. What we would do? There is a function called htonl() that would make exactly this turn. The following functions are analogous to this one and they are able to make this type of conversions :

• htons() -> ``Node to a short variable of Web'' • htonl() -> `` Node to a long variable of Web'' • ntohs() -> ``Web to a short variable of Node '' • ntohl() -> `` Web to a long variable of Node ''

You must be thinking why we need all these functions, and the cause of these orderings. Well, when this documen be finished to read all this doubts will be clear (at least a little). All you need is to read and practice a lot. An important thing, is that sin_addr and sin_port, of the sockaddr_in structure, must be of kind Bytes Ordering for Webs. We will see in the examples, the described functions to do this conversions, and will be more understood. IP Directions In C, exists some functions that will help us to manipulate directions IP. In this section we will talk about the functions inet_addr() and inet_ntoa(). On the other hand, the function inet_addr() turns an IP direction a whole length without sign (unsigned long int), for example: (...) dest.sin_addr.s_addr = inet_addr("195.65.36.12");

Page 10: UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México · 2015-02-04 · UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México Manual de Prácticas SC 471 CLIENT / SERVER SYSTEMS

(...) /*Recordar que esto sería así, siempre que tengamos una estructura "dest" del tipo sockaddr_in*/ On the other hand, inet_ntoa() turns to a chain that contains an IP direction in a whole length. For example: (...) char *ip; ip=inet_ntoa(dest.sin_addr); printf("La dirección es: %s\n",ip); (...) It is important to remember that the function inet_addr() returns the direction in Ordering Bytes format for Webs, reason why we don’t need to call a htonl().

Page 11: UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México · 2015-02-04 · UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México Manual de Prácticas SC 471 CLIENT / SERVER SYSTEMS

A Flow Server example

In this section, we will describe a pretty example of a flow server. The font code has many coments to when it would be read, there are no doubts.

Let’s start:

/* Estos son los archivos de cabecera usuales */ #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #define PORT 3550 /* El puerto que será abierto */ #define BACKLOG 2 /* El número de conexiones permitidas */ main() { int fd, fd2; /* los archivos descriptores */ struct sockaddr_in server; /* para la información de la dirección del servidor */ struct sockaddr_in client; /* para la información de la dirección del cliente */ int sin_size; /* A continuación la llamada a socket() */ if ((fd=socket(AF_INET, SOCK_STREAM, 0)) == -1 ) { printf("error en socket()\n"); exit(-1); } server.sin_family = AF_INET; server.sin_port = htons(PORT); /* ¿Recuerdas a htons() de la sección "Conversiones"? =) */ server.sin_addr.s_addr = INADDR_ANY; /* INADDR_ANY coloca nuestra dirección IP automáticamente */ bzero(&(server.sin_zero),8); /* escribimos ceros en el reto de la estructura */ /* A continuación la llamada a bind() */ if(bind(fd,(struct sockaddr*)&server, sizeof(struct sockaddr))==-1) { printf("error en bind() \n"); exit(-1); } if(listen(fd,BACKLOG) == -1) { /* llamada a listen() */ printf("error en listen()\n"); exit(-1); }

Page 12: UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México · 2015-02-04 · UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México Manual de Prácticas SC 471 CLIENT / SERVER SYSTEMS

while(1) { sin_size=sizeof(struct sockaddr_in); /* A continuación la llamada a accept() */ if ((fd2 = accept(fd,(struct sockaddr *)&client, &sin_size))==-1) { printf("error en accept()\n"); exit(-1); } printf("Se obtuvo una conexión desde %s\n", inet_ntoa(client.sin_addr) ); /* que mostrará la IP del cliente */ send(fd2,"Bienvenido a mi servidor.\n",22,0); /* que enviará el mensaje de bienvenida al cliente */ close(fd2); /* cierra fd2 */ } }

Page 13: UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México · 2015-02-04 · UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México Manual de Prácticas SC 471 CLIENT / SERVER SYSTEMS

A Flow Client example

Everyhting will be analogue to the previous section.

#include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> /* netbd.h es necesitada por la estructura hostent ;-) */ #define PORT 3550 /* El Puerto Abierto del nodo remoto */ #define MAXDATASIZE 100 /* El número máximo de datos en bytes */ int main(int argc, char *argv[]) { int fd, numbytes; /* archivos descriptores */ char buf[MAXDATASIZE]; /* en donde es almacenará el texto recibido */ struct hostent *he; /* estructura que recibirá información sobre el nodo remoto */ struct sockaddr_in server; /* información sobre la dirección del servidor */ if (argc !=2) { /* esto es porque nuestro programa sólo necesitará un argumento, (la IP) */ printf("Uso: %s <Dirección IP>\n",argv[0]); exit(-1); } if ((he=gethostbyname(argv[1]))==NULL){ /* llamada a gethostbyname() */ printf("gethostbyname() error\n"); exit(-1); } if ((fd=socket(AF_INET, SOCK_STREAM, 0))==-1){ /* llamada a socket() */ printf("socket() error\n"); exit(-1); } server.sin_family = AF_INET; server.sin_port = htons(PORT); /* htons() es necesaria nuevamente ;-o */ server.sin_addr = *((struct in_addr *)he->h_addr); /*he->h_addr pasa la información de ``*he'' a "h_addr" */ bzero(&(server.sin_zero),8); if(connect(fd, (struct sockaddr *)&server,

Page 14: UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México · 2015-02-04 · UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México Manual de Prácticas SC 471 CLIENT / SERVER SYSTEMS

sizeof(struct sockaddr))==-1){ /* llamada a connect() */ printf("connect() error\n"); exit(-1); } if ((numbytes=recv(fd,buf,MAXDATASIZE,0)) == -1){ /* llamada a recv() */ printf("Error en recv() \n"); exit(-1); } buf[numbytes]='\0'; printf("Mensaje del Servidor: %s\n",buf); /* muestra el mensaje de bienvenida del servidor =) */ close(fd); /* cerramos fd =) */ }

Page 15: UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México · 2015-02-04 · UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México Manual de Prácticas SC 471 CLIENT / SERVER SYSTEMS

ACTIVITIES TO MAKE BY THE STUDENT. 1. Objectives exhibition and proposed methodology by making the practice. 2 The practice is divided in two parts:

2.2 Make a program conected to an eco server using sockets. For this, you need to know the IP directions or addresses of a server and the eco port and use the documents about the sockets functions.

2.2 Make a program to add a simple eco server, that must show the received information by the previous section program. It must be able to show all the content of the received message, it can be of text or binary.

3 Comparison and analisis of the obtained results during the practice.

The professor will make a dynamic in which the students will expose the experiences acquired during the development of the practice.

PRACTICE GRADE SIGNATURE´S AND NAME´S PROFESSOR

Page 16: UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México · 2015-02-04 · UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México Manual de Prácticas SC 471 CLIENT / SERVER SYSTEMS

LABORATORY PRACTICE

Licenciatura en Sistemas Computacionales y Administrativos SC-471 Client/Server Systems

Formation Area: Software Engineering

PRÁCTICE 2

Client/Server

PLACE: Computation Laboratory TIME:

6 HOURS

OBJECTIVE:

The objective of this practice is to desing and add a client/server protocol.

INTRODUCTION Client/Server LAN In the most formal sense, the term client/server describes a system in which a machine asks to another called server, to do a specific work. The client usually is a common personal computer conected to a LAN, and the server is, usually, a host machine, as a PC files server, an UNIX files server or a macrocomputer or mid level computer. The client program does two different functions: first, takes meassures to obtain comunication with the server, asks for a service and receives the sent data. Second, it manages the interface with the user: presenting the data in the correct format and brings the necessary tools and comands to the user so he could use the services of the server in a simple way. The server program, in contrary, just is responsible for transmiting information in an efficient way. It does not have to attend the user. In this form, one same server can attend many clients at the same time. Some of the main client/server LAN with specialized servers that can do works for clients include the Windows NT, NetWare of Novell, VINES of Banyan and LAN Server of IBM. All these web operating systems can opperate and prosecute application requests that are made in clients, through the requests processing.

Page 17: UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México · 2015-02-04 · UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México Manual de Prácticas SC 471 CLIENT / SERVER SYSTEMS

LABORATORY PRACTICE Practice purpose The purpose of this practice is to design and add a client/server protocol, that then will be used to make a namer server. This protocol will have the following functions:

• When a client needs a server, it will send a request message to the server. • The server is waiting for requests. When a client request message is sent,

the server attends this message and sends it back with an answer. The server process will turn bigger in tha most general way, so then will be easier to adapt itself to any other kind of concrete server.

• A messages protocol will be design in a correct way between the client and the server, because if a message is lost, this is repeated, if the client or the server falls, the situation will be restored, if a server takes much time to answer, the client will be conscious of the situation and will know for making a difference with a fallen server, etc.

• While a message is attended, other messages could be sent, these would be attended at the same time to a maximum set number, initially to 5. (we’ll have to use the calling of the system “pthread_create”). If are too much requests, the clients would have to wait.

• Using the defined protocol, the practice consists in the desing and the turned bigger of a names server.

• The names server will be in a machine known for all the servers and clients, and will be conected to a specific port. A shaped file will be used to contain these data, also in the names server as in the rest of servers and clients.

• Any other server in the moment to begin will send a message to the names server to ger a register. It will inform about its name and the machine and port where it is.

• When a client would have the necessity of knowing the address and port of a server, it will send an asking question to the names server, which will answer with those data.

• The names server will be able to attend many requests at the same time. • When a server is going to be closed, it will inform previously to the names

server to erase it from the available servers list. Optional possibilities:

• The names server could be used to divide the load between many servers with the same name that are in use in different machines.

• The names server will do a “poolling” frecuently to find fallen servers, eliminating them form the servers list.

• The clients could do “caché” in the servers addresses, in a way that they can ask for just the first time, or when they ask a request the server won’t answer.

Page 18: UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México · 2015-02-04 · UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México Manual de Prácticas SC 471 CLIENT / SERVER SYSTEMS

ACTIVITIES TO MAKE BY THE STUDENT. 2. Objectives exhibition and proposed methodology by making the practice. 3. Once that the names server is programmed, build two simple servers (for

example, an eco server and a time server) to be used. Make a proof of the different possibilities of mistakes with some clients and the servers that were turned bigger.

4. A brief of the practice will be given, it has to contain an explanation of the

modified options and about the mistakes and extraordinary conditions of the meassures taken. Besides, a list of the made programs will be given with a description of how are proved each one of the possible mistake conditions.

PRACTICE GRADE SIGNATURE´S AND NAME´S PROFESSOR

Page 19: UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México · 2015-02-04 · UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México Manual de Prácticas SC 471 CLIENT / SERVER SYSTEMS

LABORATORY PRACTICE

Licenciatura en Sistemas Computacionales y Administrativos SC-471 Client/Server Systems

Formation Area: Software Engineering

PRATICE 3

Remote Procedures Calling Mechanism (RPC)

PLACE: Computation Laboratory

TIME:

6 HOURS

OBJECTIVE

The purpose of the practice is to add a RCP mechanism in the basis of mechanisms and client/server protocol that were added in previous practices.

INTRODUCTION Client/Server LAN In the most formal sense, the term client/server describes a system in which a machine asks to another called server, to do a specific work. The client usually is a common personal computer conected to a LAN, and the server is, usually, a host machine, as a PC files server, an UNIX files server or a macrocomputer or mid level computer. The client program does two different functions: first, takes meassures to obtain comunication with the server, asks for a service and receives the sent data. Second, it manages the interface with the user: presenting the data in the correct format and brings the necessary tools and comands to the user so he could use the services of the server in a simple way. The server program, in contrary, just is responsible for transmiting information in an efficient way. It does not have to attend the user. In this form, one same server can attend many clients at the same time. Some of the main client/server LAN with specialized servers that can do works for clients include the Windows NT, NetWare of Novell, VINES of Banyan and LAN Server of IBM. All these web operating systems can opperate and prosecute application requests that are made in clients, through the requests processing.

Page 20: UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México · 2015-02-04 · UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México Manual de Prácticas SC 471 CLIENT / SERVER SYSTEMS

LABORATORY PRACTICE Practice purpose

• For each function that will be use in the RCP way it will be a client “stub” programed and a server "stub", that will have the function for taking meassures of the call remote.

• This "stub" will manage the communication, mistakes, translation of parameters, etc., in a way that the function user, (applications programmer) hardly sees that the called is RCP, and the code programmer of the function does not have to be counscious that its functions is going to be used as a RCP. All the parts will be enclosed in the "stub".

• The design of the client and server “stub” (with the design of remote calls server, that will have the basis of the previous practices) will be added in the most general way. In fact that, turning a new function (whose code exists yet) in RCP, just suppose to leave from a general outline for the client “stub”, specific in some parts related with the number and kind of the function parameters. In the same way, the RCP server and the server “stub” will be enough too general to require minimun changese to each added function.

• To put in practice the RCP mechanism, it has to modify the function of DNS. In this way, the DNS, will works as a DNS-RCP server now. When a server enters in the DNS register to be working, it has to retgister its RCP functions toos, because the clients could use them. On the other hand, the clients will ask for the DNS a name of a RCP function and a version of it, the DNS will answer with the server address that attends that function, and the attention RCP port.

• The poolling mechanisms and load distribution will have present now, the fact of that one same RCP function can be in many servers and viceversa.

ACTIVITIES TO MAKE BY THE STUDENT. 5. Objectives exhibition and proposed methodology by making the practice. 6. Add as RCP, a serie of functions that allow the following aritmetic calculations:

addition, substraction, multiplication, divisor, square root and exponent. You will take care witn the operating numbers of each function, for this your will take present the function version that is used (for example: adding _2(2,3), add _3(2,3,4), etc).

Page 21: UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México · 2015-02-04 · UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México Manual de Prácticas SC 471 CLIENT / SERVER SYSTEMS

7. A brief of the practice will be given, it has to contain an explanation of the

modified options and about the mistakes and extraordinary conditions of the meassures taken. Besides, a list of the made programs will be given with a description of how are proved each one of the possible mistake conditions.

PRACTICE GRADE SIGNATURE´S AND NAME´S PROFESSOR

Page 22: UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México · 2015-02-04 · UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México Manual de Prácticas SC 471 CLIENT / SERVER SYSTEMS

LABORATORY PRACTICE

Licenciatura en Sistemas Computacionales y Administrativos SC-471 Client/Server Systems

Formation Area: Software Engineering PRACTICE 4

Servers WEB: CGI/Perl

PALCE: Computation Laboratory

TIME:

6 HOURS

OBJECTIVE

The purpose of this practice is to introduce the student in the Web servers programing trhough CGI, doing a specific point in the information storage obtained from the user, and creating Web pages form storaged data in files. For this the SAMBAR web server will be used under Windows environment, and the Perl programing language.

INTRODUCTION WEB Servers In any application focused to the Web, is necessary to program the server, this means, to do programs series that answer the user requests, and create dynamic web pages. About this base, different ways to make this programing have been developed. One with much popularity in Windows, is the ASP (Active Server Pages), that consist in stamps series included into web pages, which use Visual Basic as their language. However, this subject is covered by other proposed courses to the CFC, for this,we are not going to talk about it. Because of the popularity of Java language, nowadays are many ways to use it into a Web server, two of them are: with servlets , little programs in Java that are executed in a persistent way in the server, and for this, they have a very quickly activation, and a simpler way to do it, the JSP (Java Server Pages), that consist of small code pieces in Java that are put into web pages, in a same way of the before ASPs. Both options, nowadays, are very pupular in electronic comerce sites. Infront to the ASPs, the advantaje they have is that they are independent from the operating system and from the machine operator.

Page 23: UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México · 2015-02-04 · UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México Manual de Prácticas SC 471 CLIENT / SERVER SYSTEMS

In the case of PHP, it is a language whose programs are put into the web pages too, like the ASPs and JSPs; it’s use is muc h simpler and the data base access from it is very simple. It is very popular in electronic comerce sites with little trafic, because of it’s easy develop and fast implnatation. Finally, the CGI (Common Gateway Interface) were the only available method originally, and it consists in programs that are linked with the server, and for this, they can be written in any language or in font code. They also are independetn from the OS, and have the advantage of, when a written language program, it is easy to adapt to a CGI. Between the languages used for CGIs, the most popular is Perl.

Page 24: UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México · 2015-02-04 · UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México Manual de Prácticas SC 471 CLIENT / SERVER SYSTEMS

LABORATORY PRACTICE Practice purpose

• The purpose of the practice is NOT to develop high stetic design of Web pages: lto diseño estético: it will be evaluate the complex and the complete funcionality, this means, about the CGI programs associated.

• For this it will add the Web server of an online publication (magazine, newspaper, etc.) which includes many sections. For example, in the case of a newspaper, we can consider the following sections: national, international, sports, classifies.

• To manage the information of the publication online, the user will open a special page to send news or articles to the server,which will create, in an automatical way, the final la compsition with the different sections comented before.

• CGI for the management of news/articles. • There will be a page through which can be add news, since a formulary

which will call a CGI. The formulary must have the following subjects: o Tittle o Subtittle o New’s body o Clasification (sports, entertainment, etc.) o Importance (number from 1 to 10) o Author and his e-mail o A link to multimedia resource (images, videos, etc.), that will be

shown with the new. • When the new comes into the server, this makes a processing of it. This

processing consist in including a gate in a file that contents administrative information of each new, this means, the file names and reception dates of each new, the clasification, the author and the importance.

• CGI for the online publication generation. • The server will create utomatically the publication since the storage

information about the sent news by the users. In this information you must take care the date to eliminate the ancient news to focus the recent ones (maximum 5 news by clasification). The stamp and style are decission of the student, even when in the case of a newspaper, in a structure of: firs page, news nationals, internationals, sports, classified, etc

• Adds and improvements. • Chance of creating more clasifications, or subclasifications, thinking on a

tree structure. • User profile managment:

o Create the boss editor figure, who aproves, edits or eliminates a new that is going to be publicated online.

o Possibility of choice between differen presentation stamps, according to each user profile, there the publication views online will be personalized.

Page 25: UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México · 2015-02-04 · UNIVERSIDAD DE LAS AMÉRICAS, A.C. Ciudad de México Manual de Prácticas SC 471 CLIENT / SERVER SYSTEMS

ACTIVITIES TO MAKE BY THE STUDENT 8. Objectives exhibition and proposed methodology by making the practice. 9. In the practice memory will add an explanation of the HTML pages desing and

the CGI/Perl associated programs, and the used data files structure and the list of mistakes and other used conditions. Besides the list of the programs done will be given and a description of how have proved each one.

10. A brief of the practice will be given, it has to contain an explanation of the

modified options and about the mistakes and extraordinary conditions of the meassures taken. Besides, a list of the made programs will be given with a description of how are proved each one of the possible mistake conditions.

PRACTICE GRADE SIGNATURE´S AND NAME´S PROFESSOR