DLL: Networkport connection test

 

Hey all,

tomorrow is my king day, so i want to give the world something back. And this is my gift to the world :D


Using the normal mysql_connect function works not as expected and is hanging when the remote service is for some reason not available ( host down, db down, no network ). This is critical using this in a productive environment. Sofar i didn't found any useful function to test this. When you try to connect with mysql_connect (C) or driver->connect(C++) it will hang for some seconds until there get a timeout. But i second in this business is a long time.

Therefor i created a DLL which can handle the port socket test immediately.

!!ONLY MT5!! -> it's for x64 compiled


If you need this as x86, then download the VS2017 Project and compile it.


MQL5:

Howto import:

#import "Net\MT5_Net.dll"
   bool     connectionTest(char & host[], char & port[], int timeout );
#import


Arg 1:  uchar    m_hostChar[]
Arg 2:  uchar    m_portChar[]
Arg 3:  int        timeout

bool test = connectionTest( m_hostChar, m_portChar, 0 );
Print("TEST::::::>>" + IntegerToString(test));


Best Regards !

Dateien: