ZeroMQ PUB/SUB pattern issue

 

Hello there

I am using zmq in my copy trading project. More precisely I am using Pub and Sub pattern for sending trades signal. I have tested zmq on localhost but facing problem to make it online. 

I am not have much knowledge of networking. In zmq website they said about replace localhost with TCP IP address to make the whole thing online. In localhost testing I am using "tcp://localhost:5559" on subscriber side and "tcp://*:5559" on publisher side. When I replace localhost with IP address noting works. 

I am not sure what is the issue. Someone can please help me. 

 
Hamad Niaz -: In localhost testing I am using "tcp://localhost:5559" on subscriber side and "tcp://*:5559" on publisher side. When I replace localhost with IP address noting works. I am not sure what is the issue.

You have to allow external addresses in MetaTrader's settings in order for it to be able to connect to external hosts via sockets or web requests.

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.

Documentation on MQL5: Network Functions / SocketCreate
Documentation on MQL5: Network Functions / SocketCreate
  • www.mql5.com
SocketCreate - Network Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Fernando Carreiro #:

You have to allow external addresses in MetaTrader's settings in order for it to be able to connect to external hosts via sockets or web requests.

Thank you so much for your reply. I am using mql4 language and the document you just have send is for mql5 languages. Does this matter ?

 
Hamad Niaz - #: Thank you so much for your reply. I am using mql4 language and the document you just have send is for mql5 languages. Does this matter ?

The same conditions apply to MQL4 for Webrequest, but not for DLL calls for networking. So your problem is therefore something else. Maybe firewall settings?

 
Fernando Carreiro #:

The same conditions apply to MQL4 for Webrequest, but not for DLL calls for networking. So your problem is therefore something else. Maybe firewall settings?

IP address which I am using to send and receive data is an IP of a website. Do I need to open port on that server? I am using 5559 port which is not well known port. 

 
Hamad Niaz - #: IP address which I am using to send and receive data is an IP of a website. Do I need to open port on that server? I am using 5559 port which is not well known port. 

I suggest you ask the ZeroMQ community. This is not a MetaTrader or MQL related issue, so you are asking in the wrong place.

 
Fernando Carreiro #:

I suggest you ask the ZeroMQ community. This is not a MetaTrader or MQL related issue, so you are asking in the wrong place.

Okay sir thank you so much.