PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

  • Type of message transmission
  • Differences of operating mode between the SocketEndTag and SocketEndTagBuffer constants
  • Message with end tag
  • Transmission between two computers that use character strings in different formats (UNICODE and ANSI)
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
SocketChangeTransmissionMode (Function)
In French: SocketChangeModeTransmission
Changes the transmission mode used on a socket. This feature is used to define the message encoding during the transmission. SocketRead and SocketWrite are using the specified transmission mode.
Caution: The transmission mode must be identical on the server and on the client computer.
Notes:
  • WINDEVWindows Mobile If a WINDEV application is used on a server and on a client computer, the change of transmission mode must be performed on the client computer and on the server.
  • UDP sockets: The UDP sockets are always "Socket without tag". SocketChangeTransmissionMode must not be used with the UDP sockets. The UDP protocol is an unreliable protocol: the string returned by SocketWrite may not arrive or it may arrive several times. The strings are not always sent in order.
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.
Example
// Implement the transmission mode with EOF as end marker
IF SocketChangeTransmissionMode("Server", SocketEndTag) = True THEN
        Info("Transmission mode modified")
END
// Implement the transmission mode with CRLF as end marker
IF SocketChangeTransmissionMode(sSocketname, SocketEndTag, CRLF) = False THEN
        RESULT False
END
Syntax
<Result> = SocketChangeTransmissionMode(<Socket Name> , <Type of Transmission> [, <Option>])
<Result>: Boolean
  • True if the function was successful,
  • False otherwise (invalid socket name for example). To find out the error details, use ErrorInfo.
<Socket Name>: Character string (with quotes)
Name of socket defined on the server. This name was defined:
WINDEV Caution: the socket name is case sensitive.
<Type of Transmission>: Constant
Type of transmission to use:
SocketSizeAtBeginning
(Default value)
This message is a buffer in the following format:
<Length>+CR+<String or buffer to send>

<Length> is an ANSI string corresponding to the length of the string or buffer in bytes.
Example: "9"+CR+"HelloWord".
SocketEndTagUsed to specify an end tag in <Option>. By default, the end tag is the "<EOF>" character string.
Message in the following format: "Hello world<EOF>"
SocketEndTagBufferUsed to specify a buffer end tag in <Option>. By default, the end tag of buffer is the "<EOF>" string. Check remarks to see the difference with the SocketEndTag constant.
SocketNoEndTagNo tag is added to and/or removed from the transmitted string. In this case, the maximum number of bytes that can be transmitted can be specified with SocketRead.
<Option>: Optional character string (with quotes) or WLanguage constant (CR, CRLF, EOT)
End tag (by default, this marker is the "<EOF>" string).
Remarks

Type of message transmission

The type of message transmission specifies the mode used to define the length of the message.
By default (SocketSizeAtBeginning constant), the number of characters in the message is specified at the beginning of the message. This transmission mode is recommended when the sockets are used to communicate between two WINDEV applications.
The SocketEndTag and SocketEndTagBuffer constants allow you to use the standard mode for defining the length of messages when communicating by sockets. 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.

Differences of operating mode between the SocketEndTag and SocketEndTagBuffer constants

In both cases, the read operation on the socket waits to receive the end tag.
  • With the SocketEndTag constant: A WLanguage error occurs ("End markers not respected") if elements are received after the end marker.
  • With the SocketEndTagBuffer constant: If elements are received after the end marker, the received string is read until the end marker is reached, the remaining part is stored and carried over into the next read operation. This allows you to perform partial read operations. This mode simplifies the process of some standard protocols on Internet.
    For example: when connecting to a news server (NNTP protocol), the protocol indicates that the end tag can be "<CRLF>" or "<CRLF>.<CRLF>". With the "buffered" mode, you can read the first line, and wait for the second tag only if one is expected.

Message with end tag

If the encoding of the message takes the end tag into account, there is no need to specify it in the message.

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

Some conversions may be required (AnsiToUnicode or UnicodeToAnsi) when messages are transmitted between two computers that use character strings in different formats.
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