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
  • Number of transmitted bytes
  • Communication with robots or with non-WINDEV applications
  • Transmission between two stations using different string formats (Unicode and ANSI)
  • Permisos necesarios
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
Retrieves a message sent by another socket. This function can be used on a client computer or on a server.
Remarks:
  • UDP socket UDP is an "unconnected" protocol, so when WINDEV retrieves the message, it records the IP address and port of the machine that sent the message. This information is returned by SocketClientInfo.
  • Socket SSL: SocketRead can be used with SSL sockets.
Reminder A socket is a communication resource used by applications to communicate from one machine to another, regardless of the type of network.
WINDEVReportes y ConsultasJavaCódigo de Usuario (UMC)
// Add received messages in a Table control
TableAdd(TABLE_Table1, "1" + TAB + SocketRead("Server", False) + ...
TAB + SocketClientInfo("server", SocketAddress) + ...
TAB + SocketClientInfo("server", SocketPort))
WEBDEV - Código ServidorPHPAjax
WHILE SocketExist("MySocket") = True
sMsg is string = SocketRead("MySocket", True)
IF sMsg <> "" THEN
ListAdd(LIST_Messages, Now() + " " + sMsg)
END
END
Sintaxis
<Result> = SocketRead(<Socket name> [, <Undefined wait> [, <Maximum timeout> [, <Maximum number of bytes> [, <IncomingData delay>]]]])
<Result>: Buffer or character string
  • Message read.
  • Empty buffer or empty string ("") if no message was received.
<Socket name>: Character string
Name of the socket that received the message.
In the WINDEV applications:
WINDEV Warning: the socket name is "case-sensitive".
<Undefined wait>: Optional boolean
  • True (default): waiting indefinitely for a customer message.
  • False: wait until <Maximum wait>.
<Maximum timeout>: Optional integer or optional Duration
Maximum timeout (in milliseconds) of a client message if the undefined wait is set to False. This parameter can correspond to:
  • an integer representing the number of milliseconds,
  • a Duration variable,
  • the duration in a readable format (e.g., 1 s or 10 ms).
By default, this timeout is set to 1000 milliseconds (1 second).
<Maximum number of bytes>: Optional integer
Maximum number of characters that can be transmitted. The number of characters received is not guaranteed.
This parameter is taken into account only if the SocketNoEndTag constant is specified in SocketChangeTransmissionMode. Otherwise, this parameter is ignored.
This parameter is set to 4096 bytes by default.
<IncomingData delay>: Optional integer
Novedad versión 2025
Maximum waiting time with no data reception. If data is received during this time, the delay is reset.
AndroidWidget Android JavaPHP This parameter is not available.
Observaciones
WINDEVWEBDEV - Código ServidorReportes y ConsultasJavaCódigo de Usuario (UMC)

Number of transmitted bytes

<Maximum number of bytes> corresponds to the maximum number of characters that can be transmitted. The number of characters received is not guaranteed.
SocketRead reads a network frame and returns it immediately, without transforming it. However, the size of a network frame depends on several factors (network setting, speed and traffic on the network, ...).
SocketWrite sends (if possible) the buffer passed as parameter in a single frame. If this frame is not accepted by the network, the buffer can be divided into several frames (or the other way round, the network can merge the messages into a single frame to optimize the bandwidth).
To respect the integrity of the transmitted messages, you must use a native WINDEV and WEBDEV protocol (with the SocketSizeAtBeginning or SocketEndTag constants of SocketChangeTransmissionMode) or you must implement a specific protocol.

Communication with robots or with non-WINDEV applications

To simplify the exchanges of data by socket, a transmission mode is initialized by default.
For a communication with an external module (non-WINDEV application, robot, ...), this transmission mode can prevent the communications from operating properly.
The SocketChangeTransmissionMode function is used to change this transmission mode: the constant SocketSansMarqueurFin constant is used to leave the read and write patterns unchanged.

Transmission between two stations using different string formats (Unicode and ANSI)

When transmitting messages between two stations using a different string format (e.g. ANSI and Unicode), certain conversions may be necessary. These conversions can be made by AnsiToUnicode and UnicodeToAnsi.
AndroidWidget Android

Permisos necesarios

Esta función cambia los permisos requeridos por la aplicación.
Permiso requerido: INTERNET
Este permiso permite a las aplicaciones abrir los sockets de red.
Clasificación Lógica de negocio / UI: Lógica de negocio
Componente: wd300com.dll
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: 03/04/2025

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