You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi michaelt4268 !
The problem is NetEventsProcDLL.dll functions are designed to work with ANSI string but new MT4 works with UNICODE string.
For your separate example you should manage in such way:
For MT4 - correct:
1.
#import "NetEventsProcDLL.dll"
// Only for Clients:
int ConnectTo(uchar& ps8_ServerIP[], // in - string ps8_ServerIP = "0123456789123456"
int s32_Port, // in
int& ph_Client[]); // out - int ph_Client[1]
...
...
...
#import
2. Before call to ConnectTo(...)
make conversion UNICODE string to ANSI string:
uchar uc_ServerIP[];
StringToCharArray(ps8_ServerIP, uc_ServerIP);
and now you can connect to server -
s32_Error = ConnectTo(uc_ServerIP, s32_Port, ph_Client);
3. NetEventsProcDLL.mgh
correct this line -
was - string GetErrMsg(int ps32_Error)
needed so - string GetErrMsg(uint ps32_Error)
You example should work after that, but other examples should be corrected this way too.
Besides include NetEventsProcDLL.dll functions defitnition c++ file must be corrected for another examples.
Regards
Sergey
Dear Sergey,
Very much thanks. I successfully connect to the server after changing what you mentioned above.
And the metatrader4(client) also writes Double datatype successfully to echoserver as shown below.
However, the metatrader4(client) fails to read from the echoserver.
I check the ps32ReadLen[0] value which is 0 as shown below. If I understand correctly, no int elements have been read.
Pleas advise. dear experts here.
Dear Sergey,
Very much thanks. I successfully connect to the server after changing what you mentioned above.
And the metatrader4(client) also writes Double datatype successfully to echoserver as shown below.
However, the metatrader4(client) fails to read from the echoserver.
I check the ps32ReadLen[0] value which is 0 as shown below. If I understand correctly, no int elements have been read.
Pleas advise. dear experts here.
Hi amigo.
Please send me your MT4 client EA, something wrong in it, I'll look at.
Regards,
Sergey
Hi amigo.
Please send me your MT4 client EA, something wrong in it, I'll look at.
Regards,
Sergey
Dear Sergey,
Above is the source code for the client.mq4 and ImportNetEventsProcDLL.mqh that I am using.
Thanks a lot.
Dear Sergey,
Above is the source code for the client.mq4 and ImportNetEventsProcDLL.mqh that I am using.
Thanks a lot.
Hi amigo.
Here is EA that works as client, I tested - it sends and recieves.
Because now we have no any ticks(market is closed) I introduced Timer to call OnTick() function.
Please test and give me feedback.
Regards,
Sergey
Hi amigo.
Here is EA that works as client, I tested - it sends and recieves.
Because now we have no any ticks(market is closed) I introduced Timer to call OnTick() function.
Please test and give me feedback.
Regards,
Sergey
Dear Sergey,
Yes, it is working now. Thanks friend. You are awesome.
Hi amigo.
Here is EA that works as client, I tested - it sends and recieves.
Because now we have no any ticks(market is closed) I introduced Timer to call OnTick() function.
Please test and give me feedback.
Regards,
Sergey
Dear Sergey,
After tried your demo working. I am shifting my work to communicate between your metatrader4 (client) code with my custom C++ application (server).
My C++ application (server) is written in QT and the network module used is QT QTCPSocket and QTCPServer. (*fyi not your library)
The data transfer is successful from the metatrader 4 using your code to my C++ application.
However, the data transfer is not successful from my C++ application to the metatrader 4.
The metatrader4 code seems to not receive any data because the variable ps32_ReadLen display 0 while communicating with my C++ application.
Some of my observation:
At the metatrader 4 client execution, the ReadFromDouble return code is 0, and the ps32ReadLen[0] value is 0 as well. According to your material above, it means there is no data in the client stack with specified handle.
However,I have double checked my C++ TCP server whereby, another TCP client can receive the data.
Some of my test:
I test my C++ TCP server using a 3rd party software SocketTest v 3.0.0
When the SocketTest(client) send "HelloServer", the server will resend back "888999000" as shown above. So i assume the TCP server has no problem sending out messages.
I use the 3rd party software to simulate as TCP server and tries to send messages to the metatrader4 client.
But the variable ps32_ReadLen[0] value displays 0. This variable does display 1 when use your server.
The question I would like to ask is whether your metatrader 4 code can work with other C++ application.
If can, do you have any idea or any advise to me to solve the problem above?
Thanks.
Dear Sergey,
After tried your demo working. I am shifting my work to communicate between your metatrader4 (client) code with my custom C++ application (server).
My C++ application (server) is written in QT and the network module used is QT QTCPSocket and QTCPServer. (*fyi not your library)
The data transfer is successful from the metatrader 4 using your code to my C++ application.
However, the data transfer is not successful from my C++ application to the metatrader 4.
The metatrader4 code seems to not receive any data because the variable ps32_ReadLen display 0 while communicating with my C++ application.
Metatrader 4 ReadFromDouble Code:
Some of my observation:
At the metatrader 4 client execution, the ReadFromDouble return code is 0, and the ps32ReadLen[0] value is 0 as well. According to your material above, it means there is no data in the client stack with specified handle.
However,I have double checked my C++ TCP server whereby, another TCP client can receive the data.
The question I would like to ask is whether your metatrader 4 code can work with other C++ application.
If can, do you have any idea or any advise to me to solve the problem above?
Thanks.
DLL (Dynamic Link Library) functions is universal mean to exchange info between any programs independantly on lang in which they were developed.
One only thing is important - every lang has it's own rules to call DLL fuctions, that's all.
So if you use mine DLL interface you have no any problems.
DLL (Dynamic Link Library) functions is universal mean to exchange info between any programs independantly on lang in which they were developed.
One only thing is important - every lang has it's own rules to call DLL fuctions, that's all.
So if you use mine DLL interface you have no any problems.
I didnt use your DLL on C++ Server application.
I use your mqh in the metatrader 4 client .
Can it work this way?
I didnt use your DLL on C++ Server application.
I use your mqh in the metatrader 4 client .
Can it work this way?
Yes it can, but MT4 client must know your c++ server protocol, besides look at how MT4 DLL functions must be dtfined:
After connection is established your MT4 client should use this funtions for info exchange with your c++ server, something like that:
Yes it can, but MT4 client must know your c++ server protocol, besides look at how MT4 DLL functions must be dtfined:
After connection is established your MT4 client should use this funtions for info exchange with your c++ server, something like that:
I tested this java client/server.
Results are:
1. MT4 client can connect to it
2. MT4 client can send info to it and he recieves this info
2. MT4 client does't recieve info from this java client/server - the reason is my software is designed to send/recieve data blocks with variable length,
data block length is contained in the 4 bytes header, so MT4 client don't read it's data from stack until data length equal to number in 4 bytes header,
but in the case when java server send only character strings this number is very very very large !
So I should redo some things in my sofware for you to use it, or you should form data length four bytes header for every data block to send to MT4 terminal.
In other words MT4 client and it's software environment waits input data in format : DWORD, Data. DWORD - is 4 bytes header that comtains number of data itself + 4.