Discussion of article "Working with sockets in MQL, or How to become a signal provider" - page 2

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
Is this a forum for low-level network programming? )))
who wants to learn and use client-server technologies in
- copiers
- newsletters
- signals distribution
- exchange of trading information
he takes note of it and uses it.
but not in your case, you're just out of the loop,
so feel free to pass by.
I will delete flud.
the article reveals new possibilities, not makes a test of your knowledge.
who wants to learn and use client-server technologies in
- copiers
- newsletters
- signals distribution
- exchange of trading information
he takes note and uses it.
but not in your case, you're just out of the loop,
so feel free to pass by.
Flooding will be deleted.
very well done, neat, no rush,
mapping those stupid socket structures to the MQL base.
is very clear and clear. Here https://www.mql5.com/en/articles/1361.
also about the same socket topic, but perhaps very cumbersome,
for simple tasks the approach proposed by the author is preferable...
thanks to the author, for me, for example, it is very relevant to the current project, I will use it...
is there any way to do the same on mql4 without using third-party dlls.
yes. all the codes given in the article are reproduced similarly in mql4. but you still have to use a Windows dll.
I don't understand why there is such mass scepticism when a person shares such a serious topic. Is it jealous that someone knows and someone else doesn't even realise what it is?
Especially since now everyone has an opportunity to understand the topic.
I don't understand why there is such mass scepticism when a person shares such a serious topic. Is it jealous that someone knows and someone else doesn't even realise what it is?
Especially since now everyone has the opportunity to understand the topic.
The code in the article is wrong. You do not take into account alignment in structures at all.
The size of a structure in x64 is a theoretical calculation based on the assumption that pointer alignments == 8 (8 is most likely. But, for example, alignof(double) in structures == 4 and outside == 8. That's why I'm not 100% sure). But even if it is 4, the structure's size in x64 will be 404 instead of 408. In any case, you overflow the buffer under WSData both on x86 and x64. Before writing an article, you should make the simplest sizeof() measurements and explicitly specify the bitness of the system the code is written for (since you have taken to duplicating system structures). I am not talking about the unaligned initial address of the structure. I haven't checked the whole code, perhaps there are problems with other structures too.By the way, if someone from the MKL team sees the message: all your addresses are unaligned, why? Modern processors are smart enough and all models will be able to read the data? A small fee in the form of performance loss, but nothing more (nothing like crashing).
I'm not quite right though. In MQL, the size of WSData will be much larger than necessary (lpVendorInfo[] is a dynamic array with size around 50, not a pointer). So the code should work correctly. But this is an accident, you are lucky, not correct theoretical assumptions. The structure itself in MKL is not valid, it is better to create an array of sufficient size and not declare anything. If you had written:
you would have got an error.yes, in MQL structures are aligned https://www.mql5.com/en/docs/basis/types/classes
judging by the contents of WinSock2.h the WSAData structure is without #pragma pack(1), so its size as you said may be more than µl.
But I can say that either something counts wrong or these data do not kill the stack, but all mcl software with these sockets works stably and without losses for months without terminal reloading.
Figuring it out all the way through would be good.
And don't worry about alignment or where the compiler put the extra bytes. You're not accessing any field anyway, so what's the point of this headache of trying to declare a structure?