I have created a socket file something like the following and want that the output of the socket must be read by the MQL5. See the following Python code:
daemon.py
import socket
#import arcpy
def actual_work():
#val = arcpy.GetCellValue_management("D:\dem-merged\lidar_wsg84", "-95.090174910630012 29.973962146120652", "")
#return str(val)
return 'dummy_reply'
def main():
sock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM )
try:
sock.bind( ('127.0.0.1', 6666) )
while True:
data, addr = sock.recvfrom( 4096 )
reply = actual_work()
sock.sendto(reply, addr)
except KeyboardInterrupt:
pass
finally:
sock.close()
if __name__ == '__main__':
main()
client.py
import socket
import sys
def main():
sock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM )
sock.settimeout(1)
try:
sock.sendto('', ('127.0.0.1', 6666))
reply, _ = sock.recvfrom(4096)
print reply
except socket.timeout:
sys.exit(1)
finally:
sock.close()
if __name__ == '__main__':
main()
Kindly, help me in accepting the output of the socket through MQL5
EDITED
I just want that the reply
should be accepted on the MQL5 in a variable, which produced by the daemon.py
. How I can do that? Say I want that MQL5 should print the response from the Python , as in the above example, I want that MQL5 should give output as dummy_reply
in string variable if possible.
Is there any possibility with ZeroMQ?
I want to get the client.py
to be done with MQL5 instead of using Python. Please help me.
reply
should be accepted on the MQL5 in a variable, whch produced by thedaemon.py
. How I can do that? Say I want that MQL5 should print the response from the python , as in the above example, I want that MQL5 should give output asdummy_reply
in string variable if possible. – Spectroscope