Network functions

MQL5 programs can exchange data with remote servers, as well as send push notifications, emails and data via FTP.

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.

Adding the address to the list

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

SocketCreate

Create a socket with specified flags and return its handle

SocketClose

Close a socket

SocketConnect

Connect to the server with timeout control

SocketIsConnected

Checks if the socket is currently connected

SocketIsReadable

Get a number of bytes that can be read from a socket

SocketIsWritable

Check whether data can be written to a socket at the current time

SocketTimeouts

Set timeouts for receiving and sending data for a socket system object

SocketRead

Read data from a socket

SocketSend

Write data to a socket

SocketTlsHandshake

Initiate secure TLS (SSL) connection to a specified host via TLS Handshake protocol

SocketTlsCertificate

Get data on the certificate used to secure network connection

SocketTlsRead

Read data from secure TLS connection

SocketTlsReadAvailable

Read all available data from secure TLS connection

SocketTlsSend

Send data via secure TLS connection

WebRequest

Send an HTTP request to a specified server

SendFTP

Send a file to an address specified on the FTP tab

SendMail

Send an email to an address specified in the Email tab of the options window

SendNotification

Send push notifications to mobile terminals whose MetaQuotes IDs are specified in the Notifications tab