ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Communication / Sockets
  • 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/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Writes a message intended to another socket. This function can be used on a client computer or on a server.
Reminder: A socket is a communication resource used by applications to communicate from one computer to another regardless of the type of network.
Example
IF SocketWrite("server", "hello world") = True THEN
Message("Message sent")
END
WINDEVReports and QueriesUniversal Windows 10 AppJavaUser code (UMC)
IF SocketWrite("Server", "hello world", "www.info.fr", 2005) = True THEN
Message("Message sent")
END
Syntax

Writing into a socket Hide the details

<Result> = SocketWrite(<Socket name> , <Message>)
<Result>: Boolean
  • True if the function was successful,
  • False otherwise. If an error occurs, you can get more details on the error with ErrorInfo.
<Socket name>: Character string
Name of the socket that received the message.
In a WINDEV application, this name was defined on the server:
In a WINDEV application, on the client, this name was defined by SocketConnect, SocketConnectSSL or SocketConnectInfrared.
WINDEV Caution: the socket name is case sensitive.
<Message>: String or buffer
Message to transmit. The message format can be defined with SocketChangeTransmissionMode.
WINDEVWEBDEV - Server codeReports and QueriesUniversal Windows 10 AppJavaUser code (UMC)

Writing into a UDP socket Hide the details

<Result> = SocketWrite(<Socket name> , <Message> , <Destination address> , <Port number>)
<Result>: Boolean
  • True if the function was successful,
  • False otherwise. If an error occurs, you can get more details on the error with ErrorInfo.
<Socket name>: Character string
Name of the socket that received the message. This name has been defined by SocketCreateUDP.
<Message>: Character string
Message to transmit. The message format can be defined with SocketChangeTransmissionMode.
<Destination address>: Character string
Address of the destination computer. This address can be given in the following format:
  • IP address in XXX.XXX.XXX.XXX format (125.5.110.100 for example).
  • URL containing the server name (www.windev.com for example). This syntax is recommended.
  • IP address returned by NetIPAddress.
UDP socket: The UDP protocol is a "connectionless" protocol. The destination must be specified for each send operation. This address can be a sub-network mask, allowing you to send the message to all the computers connected with this sub-network mask.
<Port number>: Integer
Port number of the target socket.
If you are using a socket associated with a preset protocol, use the port number associated with the protocol.
If this parameter is not specified, the number taken into account corresponds to the last destination port number used for writing for this socket.
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.
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 made 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.
Component: wd300com.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 04/08/2024

Send a report | Local help