The socket communication serves first of all for a data exchange between applications in the network.
The model client-server is used for the communication in the network. It means that the designer must define two (or more) applications that will communicate to each other and decide which of the applications will provide an access to its data and which of the applications will access these data (read or write). If the application provides the data for the usage, then this application is of the the server type, if the application accesses other (provisioned) data, then this application is of the client type. Practically it means that we define so-called server socket groups in the PROMOTIC server application, and that we define client socket groups in the PROMOTIC client application.
While at the server socket group only its name and operational parameters are defined, client socket group says which nodal PC will be communicated with and which server group will be referenced from this client group.
The user defines the client part of the communication thereby that it creates client socket groups on the "PmaRoot > Sockets" page. The client is here specified by the address of the destination PC and by the name of the server group.
The server part of the communication is analogously defined by the creation of client server groups on the same page.
The communication itself is implemented by the PmaData object that is located into one of the defined (client or server) groups at the configuration and the transfer is initialized by the methods PmaData.ReadFromSocket or PmaData.WriteToSocket.
Caution: The socket communication is licensed in the PROMOTIC system, i.e. for its running in the runtime (with a runtime license), it is necessary to purchase an item for the network clients of the "PmDataClient" type. The license must be purchased only if the server socket group is defined in the application and so many licenses must be purchased how many clients the application is supposed to communicate at the most. In the development environment the socket communications are functional automatically for testing 5 clients at the most.
Both types of the protocol are used in the PROMOTIC system by default in such a way that at first the PROMOTIC head is sent and then the transferred data follows. There is a data identifier in the head that serves for the unambiguous determination of the data on the target side. This unambiguous determination is given by the "Item" item name in the socket configuration at the data (see the "PmaData > Sockets" page). Thus standard socket messages are wrapped up in the head and that's why only PROMOTIC applications can be connected to each other using this type of the communication by default.
To enable sending any user data over the sockets, a subtype of the UDP communication was created - UDP without PROMOTIC head. By this type of the communication it is possible to transfer any data defined in the data object. Because the PROMOTIC system doesn't add anything to these data, the designer can construct exactly such data that are requested by the application on the other side.
Bytes of the Integer and Long types are sent in the reverse order than on the PC (at first the HIGH and then the LOW byte). Thus sent format of Integer and Long values (so-called Big-endian) is a standard namely in the Socket communication. If it is required to send these values in the PC format (so-called Little-endian), then it is necessary to set the text "e=L;" into the item PmaData > Sockets > Item. Otherwise this item should be blank (because the head isn't sent, this item doesn't serve for the data identification).
When choosing this type of the transfer a server object (i.e. an object connected to the server socket group) can only receive data and a client object can only send data and thus only the WriteToSocket method can be called. But there can be more server objects (i.e. objects that receive data from sockets) and thus a mechanism must exist that recognizes on the data receipt what a data object this message belongs to. For this purpose it is necessary to consider the first three variables as the system ones at server data objects and the received message is stored only into the next items. Now we'll describe the form of these three system items: