Home | Sign in | English EN
  • Number of transmitted bytes
  • Communication with robots or with non-WINDEV applications
  • Transmission between two computers that use character strings in different formats (UNICODE and ANSI)
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Stored procedures
Retrieves a message sent by another socket. This function can be used on a client computer or on a server.
  • UDP socket: The UDP protocol being a "connectionless protocol", when retrieving the message, WINDEV saves the IP address and port of the computer that sent the message. This information is returned by SocketClientInfo.
  • SSL socket: SocketRead can be used with the SSL sockets.
Reminder: A socket is a communication resource used by applications to communicate from one computer to another regardless of the type of network.
Reports and Queries
// Add received messages in a Table control
TableAdd(TABLE_Table1, "1" + TAB + SocketRead("Server", False) + ...
TAB + SocketClientInfo("server", SocketAddress) + ...
TAB + SocketClientInfo("server", SocketPort))
<Result> = SocketRead(<Socket name> [, <Undefined wait> [, <Maximum timeout> [, <Maximum number of bytes>]]])
<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 value): undefined wait for a client message.
  • False: wait until the <Maximum timeout>.
<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 corresponding to 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.
Reports and Queries

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.
SocketChangeTransmissionMode is used to change this transmission mode: the SocketNoEndTag constant allows you not to modify the frames read and written.

Transmission between two computers that use character strings in different formats (UNICODE and ANSI)

It may be necessary to convert strings in order to send messages between two computers that uses different encodings (e.g., ANSI and UNICODE). These conversions can be made by AnsiToUnicode and UnicodeToAnsi.
Component: wd270com.dll
Minimum version required
  • Version 9
This page is also available for…
Click [Add] to post a comment