Examples: MetaTrader 4 Expert Advisor exchanges information with the outside world - page 3

 
more:

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.

Yes, it makes all the sense now with the 4 bytes header. 

After adding in the 4 bytes header, my MT4 terminal is now able to receive the desired strings successfully. Thanks.

Thanks Sergey!

By the way, I did also notice that the NetEventsProc.exe takes up quite a big chunk of the CPU when it tries to connect to the localhost server when the server is not opened.

 

in the task manager, it can up from 50% to 80% of my CPU.  2.8GHz

 

Besides that, another feedback is at the metatrader4, I am unable to check the connection status, not sure whther the server has closed the connection or not. I need to use sendToString to check its status. If sendToString success, then the connection ok. If the connection not ok, the sendToString will fail. 

 
michaelt4268:

Yes, it makes all the sense now with the 4 bytes header. 

After adding in the 4 bytes header, my MT4 terminal is now able to receive the desired strings successfully. Thanks.

Thanks Sergey!

By the way, I did also notice that the NetEventsProc.exe takes up quite a big chunk of the CPU when it tries to connect to the localhost server when the server is not opened.

 

in the task manager, it can up from 50% to 80% of my CPU.  2.8GHz

 

Besides that, another feedback is at the metatrader4, I am unable to check the connection status, not sure whther the server has closed the connection or not. I need to use sendToString to check its status. If sendToString success, then the connection ok. If the connection not ok, the sendToString will fail. 

Besides that, another feedback is at the metatrader4, I am unable to check the connection status, not sure whther the server has closed the connection or not. I need to use sendToString to check its status. If sendToString success, then the connection ok. If the connection not ok, the sendToString will fail. 

This is natural for Client, we can do nothing with such situation...
 

 
more:

Besides that, another feedback is at the metatrader4, I am unable to check the connection status, not sure whther the server has closed the connection or not. I need to use sendToString to check its status. If sendToString success, then the connection ok. If the connection not ok, the sendToString will fail. 

This is natural for Client, we can do nothing with such situation...
 

Dear Sergey,

Noted with thanks.

Appreciate your help. 

 
Hello,
Anyone can show me an example how to I must reference NetEventsProcDLL.dll functions in VB.Net? Thanks in advance!
 

Dear Sergey,

I'm testing your code (EA server and c++ client) for a couple of days, without changing any code. Whatever data I sent from client.exe, EA server looks like reading it, gives the length of data correctly (let say 7), but prints the read data as "0123456", same anomaly goes on the C++client side... it just prints "o" as received string, not the characters I've sent but the read data length correct again, and this is going on without any errors in both side... The code I wrote on Labview also doing the exact same thing... Can this be about unicode/Ansi change you mention? any clue about how to fix it?

Many thanks in advance.. 

Suha 

 

hi guy i try  to use  this  awesome  script , i  choice  the  3  possibility 

1.2.3. МetaТrader 4 Expert Advisor-indicator (the Expert Advisor-server) & МetaТrader 4 Client-indicator

this is  my step i did do

1.

  • NetEventsProcDLL.dll - place it into the "C:\Windows\System32\" folder.

  • NetEventsProc.exe - create "C:\NetEventsProc\" folder and place

  • ImportNetEventsProcDLL.mqh - "MetaTrader 4\include".

2.  Place the ServerSendInd.mq4 file in the terminal data folder "МetaТrader 4\experts\" and compile it.

3. Place the ClientIndicator.mq4 file in the terminal data folder "МetaТrader 4\indicators\" and assign the local IP in my case 192.168.1.105 (ip of    my server)

4. Run ServerSendInd.  my console  answer  this "2016.06.13 10:51:47.129    ServerSendInd USDCHF,H1: ClientCount = 0" i think is correct

5. Now in pc  where  i have  my  clientindicator.mq4  run it but  i have this  error

'ClientIndicator.mq4'    ClientIndicator.mq4    1    1
'ImportNetEventsProcDLL.mqh'    ImportNetEventsProcDLL.mqh    1    1
function must return a value    ClientIndicator.mq4    146    5
declaration of 's32_Error' hides global declaration in file 'ClientIndicator.mq4' at line 27    ImportNetEventsProcDLL.mqh    130    22
'87' - case value already used    ImportNetEventsProcDLL.mqh    206    8

1 error(s), 2 warning(s)        2    3

someone can help me???   thankz  so  much 

the  pc  work with  windows 7 32bit  with out  firewall  in my lan

server work in 192.168.1.105 and  client in 192.168.1.106

 

hi  guy

i  have  the  same  error  of   michaelt4268

i  tryed  to modify  but  now  i have  this  error

'ConnectTo' - function must have a body    ClientIndicator.mq4    80    19


and  the  error is  in line  modify

//s32_Error = ConnectTo(ps8_ServerIP, s32_Port, ph_Client);

      s32_Error = ConnectTo(uc_ServerIP, s32_Port, ph_Client);   


anyone  can helpp me ??' thankz 

 

Hello!

I have a problem with the loading of the dll. I get error Cannot load 'NetEventsProcDLL.dll' [1114]. I get this error on both my laptop and vps. Can anyone help me with this issue?  I searched for a way to fix this issue but nothing works.