ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Communication / Sockets
  • Communication with robots or with non-WINDEV applications
  • Transmission between two workstations using different string formats (Unicode and ANSI)
  • Required permissions
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Retrieves a message sent by another socket. This function can be used on a client computer or on a server.
Remarks:
  • Socket UDP: Since UDP is an "unconnected" protocol, WINDEV records the IP address and port of the machine that sent the message when retrieving it.. 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.
Syntax
<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:
<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
New in version 2025
Maximum waiting time without IncomingData. If data is received during this time, the delay is reset.
AndroidAndroid Widget This parameter is not available.
Remarks

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 workstations 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.
AndroidAndroid Widget

Required permissions

This function changes the permissions required by the application.
Permission required: INTERNET
This permission allows the applications to open the network sockets.
Business / UI classification: Business Logic
Component: wd300com.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 11/26/2024

Send a report | Local help