PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

  • 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)
  • Required permissions
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Retrieves a message sent by another socket. This function can be used on a client computer or on a server.
Notes:
  • 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 the applications to communicate between computers regardless of the network type.
Versions 15 and later
Android This function is now available for the Android applications.
New in version 15
Android This function is now available for the Android applications.
Android This function is now available for the Android applications.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
Universal Windows 10 App This function is now available for the Windows Phone applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
Universal Windows 10 App This function is now available for the Windows Phone applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Universal Windows 10 App This function is now available for the Windows Phone applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Android Widget This function is now available in Android Widget mode.
Versions 23 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 23
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
WINDEVReports and QueriesJavaUser code (UMC)
// Add the incoming messages into a table
TableAdd(TABLE_Table1, "1" + TAB + SocketRead("Server", False) + ...
TAB + SocketClientInfo("server", SocketAddress) + ...
TAB + SocketClientInfo("server", SocketPort))
Windows Mobile
// Display the incoming message
Info(SocketRead("Server", False))
WEBDEV - Server codePHPAjax
WHILE SocketExist("MySocket") = True
sMsg is string = SocketRead("MySocket", True)
IF sMsg <> "" THEN
ListAdd(LIST_Messages, Now() + " " + sMsg)
END
END
Syntax
<Result> = SocketRead(<Socket Name> [, <Undefined Wait> [, <Maximum Time-out> [, <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 (with quotes)
Name of socket that received the message.
In the WINDEV applications:
WINDEV Caution: the socket name is case sensitive.
<Undefined Wait>: Optional boolean
  • True (default value): undefined wait for a client message.
  • False: wait until the <Maximum time-out>.
<Maximum Time-out>: Optional integer or optional Duration
Maximum time-out (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,
  • Versions 23 and later
    the direct indication of duration (1 s or 10 ms for example).
    New in version 23
    the direct indication of duration (1 s or 10 ms for example).
    the direct indication of duration (1 s or 10 ms for example).
This time-out is set to 1000 milliseconds by default (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.
Remarks
WINDEVWEBDEV - Server codeReports and QueriesWindows MobileJavaUser code (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 transformation. 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 in 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)

Some conversions may be required when messages are transmitted between two computers that use character strings in different formats (Windows (ANSI) and Windows Mobile (UNICODE) for example). These conversions can be performed by AnsiToUnicode and UnicodeToAnsi.
AndroidAndroid Widget

Required permissions

The call to this function modifies the permissions required by the application.
Required permission : INTERNET
This permission allows the applications to open the network sockets.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230com.dll
Windows Mobile wp230com.dll
Java wd230java.jar
Linux wd230com.so
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment