Raw Socket Client for MT4??? - page 2

 
Carl Schreiber:

Does anybody remembers those good old days? What about an old fashioned RAM-disk and the use of simple Files read/write by WinApi functions?

I think that sockets are possibly older/more old-fashioned than RAM disks <g>, but I do like running MT4 from a RAM disk for various purposes - though not this one.

Advantages of socket communication:

  • Works with both a local or remote client & server, whereas a RAM disk is purely a local option
  • Guaranteed to be available (and any Windows emulation such as Wine should support Winsock calls), whereas a RAM disk requires separate setup/configuration.
  • Polling for changes on a RAM disk file is less efficient than polling a socket.
  • Simpler handling of a one:many relationship between server:client rather than just one:one communication.

 
Hi Carl, is Ram-disk only for HDDs or will it also speed up SSDs? I wonder if my vps provider will let me install this! thanks
 
ciref:
Hi Carl, is Ram-disk only for HDDs or will it also speed up SSDs?
Neither. A RAM disk doesn't speed up a physical disk (except indirectly, in that there's less activity on the physical disk). It's a block of the computer's RAM which is treated as though it is a disk drive - with its own drive letter such as D:, the usual ability to create and delete files etc etc etc.
 
JC:
Neither. A RAM disk doesn't speed up a physical disk (except indirectly, in that there's less activity on the physical disk). It's a block of the computer's RAM which is treated as though it is a disk drive - with its own drive letter such as D:, the usual ability to create and delete files etc etc etc.

I think his question is : will a RAM disk be faster than a SSD ?

Answer : Yes of course.

 

Million times faster.

I even run my back tests in a Ram disk to save at list 30% of the total time.

 
Konstantinos Maleas:

Million times faster.

I even run my back tests in a Ram disk to save at list 30% of the total time.


If you do need consistent I/O for performance (normally going with server/high IO requirements), you can consider using NVMe SSD, after using this, you will hate to get back with normal SSD / HDD (SAS).

Anyway, socket is for event-drive communication between apps/devices and I love it for exchanging data/commands by pushing data instead of polling data.

Currently, I have just finished a simple bridge between rawsocket & websocket to push data from MT4 to any website/services in realtime (by tick event).

I'm trying learn more about programming to optimize the performance for this bridge because there is some bugs as below (because my coding skill is so low):

  • When I push data from 5-10 charts (clients) to the servers, this makes the server overflowed at the high frequency periods. From this, the server seems to combine/concat some ticks data which is pushed to it at the same time before the server forward (send) the tick value to the target clients (website/service) ---> it send a string combine 4-5 ticks data to the target client ---> target client cannot recognize the data.
  • the socket client EA cannot auto-reconnect after the first retry but failed. If can auto-reconnect but within a really short duration, if it fails, it cant do it again
  • ... some more small issue but I can handle it :)

Just some sharing :)

 
ciref:
Hi Carl, is Ram-disk only for HDDs or will it also speed up SSDs? I wonder if my vps provider will let me install this! thanks

Looking for some VPS provider that can offer NVMe SSD, you can feel the big difference for sure
 
i'm done with socker server overflowed, next is auto-reconnect.
 
JC:

If you just need to be able to send data, not to receive it, then the attached library should work.

(To help people arriving at this thread through a search engine: enhanced socket library at https://www.mql5.com/en/blogs/post/706665, combining the code in this thread with the ideas discussed in a separate thread)
 

Hi, JC!

First let me thank you so much for all you do! I will not ask how I can kiss you (lol) but will say that you are a man among men and will be known for your all your good works through all the ages:)

I am pouring over the C++ reference example available for ws2_32.dll to convert them in order to implement User Datagram Protocol (UDP) as an addition to the library and extend its capability to send and receive datagrams from MT4/5 (just locally)?

I am sure you probably have already thought of this or tried it?  I am sure there is also really a good reason it is not implemented in socke-library-mt4-mt5.mqh library as well
Could you share your experience?

Thank you again for all your hard work and even more so for sharing it!