- Different modes
- Modifying the standard behavior of sockets
- Optimizing the network frames
- Optimizing the connections for an IP address
- Re-using an address that is already used
- Using the default settings
Managing sockets with WINDEV, WEBDEV and WINDEV Mobile
WINDEV, WEBDEV and WINDEV Mobile include several functions allowing you to perform an advanced management of sockets.
A socket is a communication resource used by applications to communicate from one computer to another regardless of the type of network.
This communication mode can be used, for example, to establish a communication between computers connected by Internet.
WINDEV, WEBDEV and WINDEV Mobile allow you to manage:
- The standard sockets.
- The UDP sockets.
- The sockets by infrared.
- SSL sockets.
Examples for using sockets:
- manage a messaging in real-time.
- access to a news server (forum).
A WINDEV or WEBDEV application can manage the sockets according to different modes:
Modifying the standard behavior of sockets
Optimizing the network frames
By default, in Windows, the network frames are optimized according to the Nagle algorithm.
To communicate with a system that does not support this optimization (some embedded industrial operating systems for example), this optimization must be disabled.
To do so, enter the following code:
Socket.Option = SocketNagleOff
Optimizing the connections for an IP address
When an IP address is passed to SocketConnect
, you have the ability to optimize the connection by using the following code:
Socket.Option = SocketOptimizeIPConnection
This option is not enabled by default because the connection may fail in some configurations. However, it may be useful in some applications for which the performances are critical.
Re-using an address that is already used
By default, SocketCreate
allows you to reuse an address (already used by the application itself or by another application). To forbid this operating mode, type the following line of code:
Socket.Option = SocketNoReuseAddress
: By extension, this option allows you to find out whether an address or a port is already used. In this case, SocketCreate
returns an error.
Using the default settings
The following code allows you to restore the default setting:
Socket.Option = SocketOptionDefault
Complete examples (WINDEV): WD Live Messaging
Training (WINDEV): WD Using sockets
Sample components (WINDEV): WD Sockets
Sample components (WINDEV): WD Trace Socket
This page is also available for…