0
I am trying to send a message to a server API in order to get a response. I am using the following code:
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_address = ('h68.p.ctrader.com',5211)
sock.connect(server_address)
message = "8=FIX.4.4|9=87|35=0|49=theBroker.12345|56=cServer|57=QUOTE|50=BVN's Message|34=1|52=20180322-21:26:01|10=101"
sock.send(bytes(message,'utf-8'))
data = sock.recv(3)
print(data)
sock.close()
However, when executing it, the message is sent to the server, but when receiving the response from the server [data = Sock.recv(3)], the program does not continue. It keeps the cursor blinking, as if it were in an infinite loop. What is the probable cause of this problem? Is it the script? The message sent to the server? The server itself? How to resolve the issue?
Note: This message is in a format required by the server API, which consists of "tag"="value"|"tag"="value"|"tag"="value"...
Taking one more look at the API, I noticed that I was forgetting to put a '|' at the end of the message and that I had to exchange '|' for ' u0001'.
– Benedito