AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Comunicación / Sockets
  • Overview
  • Socket: Principle of a client application
  • Step 1: Connect to the server
  • Step 2: Data exchange
  • Step 3: End of communication
  • Transmission mode of information
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Overview
A client application of a socket server connects to a standard server to exchange information via a socket.
Example A WINDEV client application can connect to a standard Internet news server.
Socket: Principle of a client application

Step 1: Connect to the server

To connect to a server socket, all you have to do is use SocketConnect. This function makes a connection request to the server.
The socket is identified by its port and address.

Step 2: Data exchange

Once two machines have connected their sockets, a communication channel is established between them. These two machines can read from and write character strings to the socket.
Note: To avoid blocking applications, message reception is often managed by a specific thread (for more details on threads, see Managing threads).
To read from and write to the socket of the server, the WINDEV client application must use SocketRead and SocketWrite.
Caution: To perform a read, a write must have been performed.. For example:
  1. The client computer writes to the socket: it sends a request to the server.
  2. The server station reads from the socket.
  3. If a response to the message is required, the server sends a response to the client computer.

Step 3: End of communication

To terminate the connection, close the socket from the client machine with SocketClose.
Note: it is also possible to terminate the call from the server station.
Transmission mode of information
The transmission mode of the message defines the mode used to specify the length of the message.
Several methods are available to find out the length of message during the communication between sockets.
Method 1: WINDEV mode: By default, the number of characters of the message is indicated at the beginning of the message.. This transmission mode is recommended when the sockets are used to communicate between two WINDEV applications. The message looks like this: "11\r\nHelloWorld".
Method 2: standard mode: end of message is signaled by a specific, pre-determined character. This transmission mode is recommended when the sockets are used to communicate between a WINDEV application and another application. In this case, a specific character must be included in the message to indicate that the message is over. The message is in the form: "Hello World<EOF>".
Method 3: Standard mode with buffer: Corresponds to the standard mode optimized for the protocols most commonly used on the Internet. SocketChangeTransmissionMode allows you to modify the transmission mode used.
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/03/2025

Señalar un error o enviar una sugerencia | Ayuda local