My python program is talking to a device that will delay the conversation by an entire second each time it receives an ack to a push/ack. The conversation is hundreds if not thousands of messages long, so naturally I would like a way around this.
Is there a way to open a connection to my device, keep it open with the intention to send to it but don't ack messages I am receiving back with socket.recv()?
import socket
s = socket.socket()
s.bind(('', xxxxx))
s.connect(('x.x.x.x', xxxxx))
while True:
try:
msg = input()
if 'exit' in msg:
data = b'I am done now, bye'
s.send(data)
data = s.recv(2048)
print('recieved final message: ' + str(data))
break
msg = msg.encode()
s.send(msg)
print('sent message: ' + str(msg))
data = s.recv(2048)
print('received message: ' + str(data))
print()
data = ''
except Exception as e:
print(e)
s.close()