I am having some difficulties getting my program to communicate with the two Digi modems that I have.
def sockCon ():
global HOST
global PORT
global TX
TX = "\x7E\x00\x0C\x01\x00\xA5"
BUFFER = 1024
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
b = 1
while b == 1:
print ('T '+TX)
s.send(TX.encode('latin-1'))
time.sleep(5)
data = s.recv(BUFFER)
print ('R '+decode(TX,'latin-1'), BUFFER)
Basically the problem is that when it sends it will either send completely wrong or it wont send at all and it will give me this error.
TypeError: 'str' does not support the buffer interface