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
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 machine to another, regardless of the type of network.
Example
IF SocketWrite("server", "hello world") = True THEN
Message("Message sent")
END
WINDEVReports and QueriesJavaUser 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 QueriesJavaUser 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 specified as follows:
  • 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.
Socket UDP: The UDP protocol is an "unconnected" 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.
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 workstations using a different string format (e.g. Windows (ANSI) and Windows Mobile (Unicode)), some 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.
Component: wd300com.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 10/17/2024

Send a report | Local help