Tuto WINDEV 25
416 Part 7: Advanced programming Overview WINDEV proposes several functions used to perform an advanced management of sockets. A socket is a communication resource used by the applications to communicate between computers regardless of the network type. This communication mode is used to establish a communication between two applications found on different computers (connected by Internet or on the same local network) or on the same computer. A WINDEV application can manage the sockets according to different modes: • Client WINDEV application: the application connects to any server and it exchanges data via a socket. • WINDEV, WEBDEV or WINDEV Mobile "Server" application: the WINDEV, WEBDEV or WINDEV Mobile application is a server, exchanging information by sockets with several client computers. The threads must be used to manage several simultaneous connections. Example WINDEV is supplied with a training example allowing you to understand the use of sockets: "WD Using sockets". This example is accessible from the WINDEV home page (Ctrl + <). Server application: for a simplified server WINDEV gives you the ability to create a simplified socket server. This server allows you to communicate with a single client computer at a time . This type of application is very useful when two remote applications must communicate. The steps for creating a simplified server are as follows: 1. Creating the socket. 2. Exchanging data. 3. Closing the socket. Creating the socket To create the socket, the server is using SocketCreate . A socket is associated with a specific port. For a simplified use of socket by programming on the server, specify the socket name. The client computer will connect to this socket in order to exchange data. The connection between the two computers will be actually established during the first exchange of data between the two computers (which means when the server reads information for the first time). The connection is established during the first successful attempt of SocketRead on the server. Exchanging data When two computers are using the same socket, a communication stream is established between these two computers. These two computers can read and write character strings on the socket. Remark : To avoid locking the applications, the management of incoming messages is often performed by a specific thread.
Made with FlippingBook
RkJQdWJsaXNoZXIy NDQ0OA==