PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • Socket: Principle of a client application
  • Step 1: Connecting to the server
  • Step 2: Exchanging data
  • Step 3: Ending the communication
  • Transmission mode of information
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
Overview
A client application of a socket server connects to a standard server in order to exchange information via socket.
Example: A client WINDEV application can connect to a standard news server on Internet.
Versions 17 and later
iPhone/iPad This feature is now available for the iPhone/iPad applications.
Universal Windows 10 App This feature is now available for the Windows Phone applications.
New in version 17
iPhone/iPad This feature is now available for the iPhone/iPad applications.
Universal Windows 10 App This feature is now available for the Windows Phone applications.
iPhone/iPad This feature is now available for the iPhone/iPad applications.
Universal Windows 10 App This feature is now available for the Windows Phone applications.
Versions 23 and later
Universal Windows 10 App This feature is now available in Universal Windows 10 App mode.
New in version 23
Universal Windows 10 App This feature is now available in Universal Windows 10 App mode.
Universal Windows 10 App This feature is now available in Universal Windows 10 App mode.
Socket: Principle of a client application

Step 1: Connecting to the server

To connect to a server socket, all you have to do is use SocketConnect. This function is used to perform a request for connecting to the server.
The socket is identified by its port and by its address.

Step 2: Exchanging data

Once two computers have connected their socket, a communication channel is established between these two computers. These two computers can read and write character strings on the socket.
Note: To avoid locking the applications, the management of incoming messages is often performed by a specific thread (see Managing threads for more details).
To read and write on the server socket, the WINDEV client application must use SocketRead and SocketWrite.
Caution: To perform a read operation, a write operation must have been done beforehand. For example:
  1. The client computer writes into the socket: it sends a request to the server.
  2. The server computer performs a read operation in the socket.
  3. If a response to the message is required, the server sends a response to the client computer.

Step 3: Ending the communication

To end the communication, all you have to do is close the socket from the client computer with SocketClose.
Note: you also have the ability to end the communication from the server.
Transmission mode of information
The transmission mode of the message defines the mode used to specify the length of the message.
Several methods are available to find out the length of message during the communication between sockets.
Method 1: WINDEV mode: By default, the number of characters in the message is specified at the beginning of message. This transmission mode is recommended when the sockets are used to communicate between two WINDEV applications. The message has the following format: "11\r\nHelloWorld"
Method 2: standard mode: The end of the message is signaled by a specific character, defined in advance. 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. The message has the following format: "Hello World<EOF>"
Method 3: standard mode with buffer: Corresponds to the standard mode optimized for the most frequently used protocols on Internet. SocketChangeTransmissionMode allows you to modify the transmission mode used.
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment