Computer networks in education

!


Client
The role of the client in the proposed monitoring system is reading technological data and their visualization.A standard client works with a known port, which in this case is referred to as the reserved port.The reserved ports are installed in order to establish a connection with the server.To establish a connection, the client must know the number of the port on which the service is offered by the server (for example ftp).Other programs of a client type operate as non-standard clients.Therefore, after establishing a connection between the client and server it is not necessary to use the reserved port (it is even not desirable due to liberation of the port for further communication) and the communication is performed on randomly selected and mutually conflictfree ports from the range of dynamic and private ports.The reserved port is after establishing the connection released immediately for possible communication with another client.
Reading of technological data is ensured by the recording client that is realized as a controller of the device reading the relevant technological process quantity, which it subsequently sends to the server.It is possible to run multiple recording clients under one operating system (PC).In this case, each client ensures reading and transfer of different technological quantity.There are no specific requirements of the environment, in which this part is realized, except for the ability to use the TCP/IP protocol for the connection with the server program.
The presenting client then receives the current copies of the data of the technological process quantities from the server and ensures their presentation.It is possible to have more presenting clients running within the network -one presenting client under one operating system (PC).

Server
Collection and distribution of data is performed by the server program.Its functions can be divided into three main points: 1. Receiving data from the recording clients 2. Maintaining the current copies of the read data 3. Sending the current data to the presenting clients.
The proposed system uses two kinds of servers depending on the time needed to perform the required processes.Their function can be characterized as follows: 1.In the event the server is able to handle the clients` requests in a short period of time, the server processes these requests itself.This type of processes in the model is called iterative server.A typical example of an iterative server is a service providing date and time.
2. If the time for the processing of a client`s request is unlimited, the server processes the request in a competitive way.This type of server is called competitive.The competitive server -parental process (master server) creates its copy -the descendant.The descendant then further processes the client`s request, so the original (parental) process of the server may again go into a sleep mode and wait for the next client`s request.This type of server of course requires an operating system, which allows simultaneous running of multiple processes.The competitive servers are widely used for example in ftp and Telnet services.The established connection between the client and the server usually contains multiple requests -in other words, multiple exchanges of queries and answers take place between the client and the server.

Program Client
Communication between the client and server through the TCP protocol is carried out according to the following algorithm: 1. Finding the IP address of the server from the specified name or address input in dot notation.

Program Server
Processing of the clients` requirements is performed by the server in a competitive way.In most cases it is an apparent competition, which is achieved by sharing the process in time.
The basic algorithm of the Server program is as follows: 1) Immediately after starting, the Master server program creates mailboxes for communication and these are associated with the reserved ports -functions socket() and bind().The ports for the connection with the clients are defined in the server configuration file.

Fig. 3 &RPSHWLWLYH 7&3 VHUYHU
2) After they have been created, the mailboxes are set into a passive state in which they are waiting for connections from the clients -functions listen() and select().Using the select() function, the kernel can put the master server process into a standby mode.In this mode it waits until an event occurs, then it is activated.In the proposed model, the kernel notifies the master server process only in the case when data for connection initialization (i.e.data for reading) appear on any of the mailboxes.
3) At the occurrence of the event "connection request", the master server receives the request on the related port -function connect().If the case of a recording client, the master server makes a checkout of the number of the connected recording clients.If a new client exceeds the maximum number of the recording clients, the connection is closed and the master server again puts itself into a sleep mode.It the event there is enough room for the connection of a new recording client, a call to the kernel function fork() is executed, resulting in the creation of a descendant to see to the operator's requirements.If a presentation client is connected, the way of the processing of the connection request is the same except for the checkout of the maximum number of connected recording clients.After that, the master server closes the no more necessary mailbox that was created by the prior calling of the connect() function.
4) Message exchange between a client and the server through the established connection • The server (descendant) serving the recording client waits for the data sent by the client.After receiving the data, the server writes them in the shared memory.The synchronization of the access to the shared memory with other processes is ensured by semaphores.After entering the data in the shared memory, the server sends a signal that indicates to all other servers (descendants) that new data has been written in the shared memory.
• Server serving the recording client sends immediately after establishing the connection the contents of all slots to the client.Then it goes to sleep until it is awakened by a signal that initializes entering new data in the shared memory.Consequently, the server gains access to the control structure (header) of the shared memory, checks which slots contain new data and sends this data immediately to the client.
The described activities are carried out by both types of descendants cyclically until the connection is closed by the client or the Server program operation is terminated (by termination of master server).

Structure of the shared memory
The shared memory was used in the model in order to preserve the data obtained from the recording clients.The main reason for using this tool for inter-process communication was the possibility of a simultaneous access of multiple processes (descendants of the master server) to the data stored in the shared memory.A synchronization of the access, for example by semaphores, is necessary to enable access of multiple processes to the shared memory.The shared memory is divided into two parts as is shown in Figure 5.

Fig. 5 6KDUHG PHPRU\ VWUXFWXUH
The area of each data slot represents a data area into which data is written by individual recording clients, with just one slot reserved for each recording client.The server serving this client records only in the one related slot and in the header.The server serving the presenting client performs only reading from the shared memory from both the slot and the header areas.
The data describing individual slots are stored in the header.These particularly include entries indicating the time of the slot last modification.This data is used by the server operating the presentation client to decide whether the data from this slot has already been sent to the client or whether it is newly received data to be sent.

3.4.
Process synchronization methods Within the Server program it is necessary to ensure synchronization of the processes by which the data in the shared memory are accessed.The following rules must be observed in order to maintain data consistency: 1.In one moment a slot cannot be modified by more than one process.
2. If the slot is being modified, no process is allowed to read this slot.
3. The slot from which the data are just being read cannot be accessed by a process that wants to modify the data.On the other hand, a situation may occur in which two or more processes read data from the same slot.
Synchronization of all processes is based on methods using semaphores and signals.
The basic critical conditions include: termination of the connection between the client and the server, termination of work or system failure.To any of the named conditions the program Server responds by a proper termination, including the release of all tools used.For the determination of a failure or disconnection of the client program uses the primary method of sending data out of range, which evaluates the client and closes the connection.For cases where the process server does not manage to inform the client about the failure data outside the range is used symptom clipboard SO KEEPALIVE that this situation highlights the client process.Another condition which should be treated in the process of the master server, the termination of a child.In this case it is necessary to call the kernel function wait() system to avoid zombie processes.

NETWORK LOAD
When implementing network applications, the network load must be evaluated from two perspectives.It is necessary to consider to which extent the deployed applications will load the overall operation of the network and vice versa, to evaluate the effect of the network load on the application performance.These are the basic viewpoints on the performance issues of both the application and network.
With respect to the minimum network load, a method for the data transfer between the server and clients was selected that uses small packets which are sent in longer time intervals.This prevents the network from a stress load, since the network could be busy with other user applications.
To assess the effect of a long-term network load it is necessary to consider the time interval in which the data in the monitoring system must be presented.In the monitoring of a technological process it mainly concerns obtaining data for further calculations or verification of the course of the process control.The proposed monitoring system will not be significantly affected by crash network loads, which may be caused for instance by a short-term failure of the file -server.

IMPLEMENTATION OF THE MONITORING SYSTEM
For educational purposes and more detailed study on the monitoring system properties and behavior, the developed monitoring system was implemented on a real model of a technological process.This gives students the opportunity to verify the functioning of the monitoring system on a real technological device and get closer insight into the data transfer process, the functioning of the server and both the recording and presenting client.The study on real processes is still an important part of engineering education in various fields and in many cases it cannot be fully substituted by mere simulations of individual physical/chemical phenomena [7].The need for and importance of practical experience with real systems, e.g. in the form of remote laboratories, is repeatedly reflected in technical literature in the field of the role of computer technology in university education [e.g.8].

Monitoring of a technological process
The realistic model was represented by a chemical reactor, which was constructed for model studies on enzymatic hydrolysis of potentially hazardous chrometanned wastes generated during leather manufacturing.Disposal of chrome-tanned waste at open landfills where it is subjected to climatic and other external conditions is not suitable since there is a risk of oxidation of trivalent chromium present in this waste into carcinogenic hexavalent chromium salts [9].Processing of chrometanned waste, the most typical representative of which is chromium shavings, and its conversion into valuable products is therefore advantageous not only from environmental, but mainly from health protection point of view.
One of the most advanced and industrially implemented procedures so far is the technique of twostep hydrolysis under alkali conditions in the presence of a proteolytic enzyme [10].The process is done in two stages, namely alkali treatment and consecutive enzymatic hydrolysis.The results of the reaction after the first step is gelatable protein and intermediate filter cake.The cake is then subjected to enzymatic hydrolysis, giving insoluble filter cake with concentrated chromium and soluble protein hydrolyzate, which is in the terminal phase dried in vacuum evaporator.Dependent on the way in which the reaction is controlled, the reaction gives protein solution of various qualities, given specifically by gel strength (Bloom value).The model reactor allows studying the hydrolysis conditions at which it is possible to obtain desired properties of final products.
The monitoring system is implemented in the first stage of the technological process, i.e. alkaline treatment (denaturation) of chrome shavings in the chemical reactor.Simplified models of the used chemical reactor and its control are depicted in the following Figs.6 and 7, respectively.The reactor, a cylindrical tank of a type of fermentation reactor, represents a non-flow isothermal heterogeneous reactor with hollow shell, through which flows the heating liquid which is heated in a separated tank outside the reactor.The alkaline treatment takes place at a pH of 12 and a temperature of 70°C.If the pH decreases below the required level (due to the buffering effect of protein), it is adjusted by addition of an alkali.At the said pH and temperature, the hydrolysis is most efficient; an increase of either value above or below this optimal level reduces the reaction rate or affects the resulting products.
The peristaltic pump (type PS 10) is used for dosing of the reaction components.Sensor PHR01 for the measurement of pH consists of a measuring glass electrode and a reference silver-chloride electrode, which are conjugated in a common stem.The potential of the measuring electrode after it is immersed in the solution is dependent mainly on hydrogen ion concentration.The platinum thermometers Pt 100 are used for the measuring of the reaction mixture temperature and the temperature of heating liquid in the heating tank.The measured data are converted from the analogue to digital form via the ADVANTECH PCI 1716 technological card and subsequently used as input data for the control circuit.

CONCLUSIONS
The communication based on the TCP protocol guarantees a sufficient integrity of the transferred data.The system architecture makes possible the dynamic connecting and disconnecting of both the monitoring places and the programs for monitored processes data presentation.The modularity of the system has prepared good precondition for implementing the client application in the environment of any operating system equipped with the support of communication based on the TCP/IP protocol.The local network monitoring and control system has been debugged in the C-language in the OS Linux Slackware 1.2.13 and RedHat 7.1 environment and verified on the laboratory hydrolysis/fermentation reactor installed within the premises of the Faculty of Applied Informatics.
The system has been successfully implemented at the Faculty of Applied Informatics of Tomas Bata University in Zlín, Czech Republic within the framework of the subject "Computer Networks".Extended practical knowledge contributes to higher employment opportunities of the graduates on the labor market, especially in technical branches.Students can also use the system for their bachelor and master theses; in addition to the educational benefits, the theses contribute to gradual upgrading and development of the monitoring network system including its extension for example to mobile applications.

Conclusion
2. Creation of a mailbox for communication -function socket() 3. Connection to the server -function connect() 4. Data exchange with the server -functions read() or write() 5. Termination of communication with the server.