New article Working with sockets in MQL, or How to become a signal provider has been published:
Author: o_O
Hi, This code works on MQL4 ?
I'm trying to port it to mql4, and when the DLL bind() function is called at MQL StartServer function, gives me the message below:
2017.09.13 18:06:30.181 Server AUDCAD,H1: try bind...0.0.0.0:8081 2017.09.13 18:06:30.181 Access violation read to 0x00000012 in 'Ws2_32.dll'
Hi, This code works on MQL4 ?
source was compiled for x64
you need change all pointer to 32 bit
f.e. use SOCKET32 instead SOCKET64 etc
source was compiled for x64
you need change all pointer to 32 bit
f.e. use SOCKET32 instead SOCKET64 etc
Hi, works fine on MT4.
Tx mate. Incredible code!
Hi, This code works on MQL4 ?
I'm trying to port it to mql4, and when the DLL bind() function is called at MQL StartServer function, gives me the message below:
Hi, works fine on MT4.
Tx mate. Incredible code!
Hello, Trying to change this to MQL4 but running into issues due to Trade.mqh requirement on signalclient. How did you go about it?
If you could, please share your MT4 version as well, it will help newbies like me out.
Regards
Hi all,
I'm compiling on MQL5 and I keep getting the error:
cannot cast 'sockaddr_in' to 'ref_sockaddr'
at the line:
ref_sockaddr ref=(ref_sockaddr)addrin;
EDIT:
For those interested, I solved by manually copying the fields from one struct to another.
Here's the code:
... // NOT WORKING // ref_sockaddr ref = (ref_sockaddr) addrin; // my WA - WORKING ref_sockaddr ref = {0}; sockaddrIn2RefSockaddr( addrin, ref ); ... // ------------------------ // Cast (copies) a struct sockaddr_in to a struct ref_sockaddr // ------------------------ void sockaddrIn2RefSockaddr( sockaddr_in& sai, ref_sockaddr& rsa ) { // family rsa.ref[ 0] = (char) (( sai.sin_family ) & 0xff ); rsa.ref[ 1] = (char) (( sai.sin_family >> 8 )) ; // port rsa.ref[ 2] = (char) (( sai.sin_port ) & 0xff) ; rsa.ref[ 3] = (char) (( sai.sin_port >> 8 ) ); // address rsa.ref[ 4] = (char) (( sai.sin_addr ) & 0xff ); rsa.ref[ 5] = (char) (( sai.sin_addr >> 8 ) & 0xff ); rsa.ref[ 6] = (char) (( sai.sin_addr >> 16 ) & 0xff ); rsa.ref[ 7] = (char) (( sai.sin_addr >> 24 ) & 0xff ); rsa.ref[ 8] = (char) (( sai.sin_addr >> 32 ) & 0xff ); rsa.ref[ 9] = (char) (( sai.sin_addr >> 40 ) & 0xff ); rsa.ref[10] = (char) (( sai.sin_addr >> 48 ) & 0xff ); rsa.ref[11] = (char) (( sai.sin_addr >> 56 ) & 0xff ); // zero rsa.ref[12] = 0; rsa.ref[13] = 0; rsa.ref[14] = 0; rsa.ref[15] = 0; }I might add that I had many compilation errors on some WSA error codes, which I had to import manually from winsock.h, and on the function:
WSAErrorDescript
are these codes run on MT4 or only MT5,
is it possible to MT5 to MT4 live tick data transfer
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
New article Working with sockets in MQL, or How to become a signal provider has been published:
Sockets… What in our IT world could possibly exist without them? Dating back to 1982, and hardly changed up to the present time, they smoothly work for us every second. This is the foundation of network, the nerve endings of the Matrix we all live in.
This article describes the principle of creating asynchronous TCP and UDP sockets. It provides several practical examples of interaction between the server and clients.
Author: o_O