- SocketCreate
- SocketClose
- SocketConnect
- SocketIsConnected
- SocketIsReadable
- SocketIsWritable
- SocketTimeouts
- SocketRead
- SocketSend
- SocketTlsHandshake
- SocketTlsCertificate
- SocketTlsRead
- SocketTlsReadAvailable
- SocketTlsSend
- WebRequest
- SendFTP
- SendMail
- SendNotification
Network functions
MQL5 programs can exchange data with remote servers, as well as send push notifications, emails and data via FTP.
- The Socket* group of functions allows establishing a TCP connection (including a secure TLS) with a remote host via system sockets. The operation principle is simple: create a socket, connect to the server and start reading and writing data.
- The WebRequest function is designed to work with web resources and allows sending HTTP requests (including GET and POST) easily.
- SendFTP, SendMail and SendNotification are more simple functions for sending files, emails and mobile notifications.
For end-user security, the list of allowed IP addresses is implemented on the client terminal side. The list contains IP addresses the MQL5 program is allowed to connect to via the Socket* and WebRequest functions. For example, if the program needs to connect to https://www.someserver.com, this address should be explicitly indicated by a terminal user in the list. An address cannot be added programmatically.
Add an explicit message to the MQL5 program to notify a user of the need for additional configuration. You can do that via #property description, Alert or Print.
Function |
Action |
---|---|
Create a socket with specified flags and return its handle |
|
Close a socket |
|
Connect to the server with timeout control |
|
Checks if the socket is currently connected |
|
Get a number of bytes that can be read from a socket |
|
Check whether data can be written to a socket at the current time |
|
Set timeouts for receiving and sending data for a socket system object |
|
Read data from a socket |
|
Write data to a socket |
|
Initiate secure TLS (SSL) connection to a specified host via TLS Handshake protocol |
|
Get data on the certificate used to secure network connection |
|
Read data from secure TLS connection |
|
Read all available data from secure TLS connection |
|
Send data via secure TLS connection |
|
Send an HTTP request to a specified server |
|
Send a file to an address specified on the FTP tab |
|
Send an email to an address specified in the Email tab of the options window |
|
Send push notifications to mobile terminals whose MetaQuotes IDs are specified in the Notifications tab |