I am trying to sent a list that contains both integer values as well as string values to a remote computer via socket communication. I tried converting the list to a bytearray that can then be sent using socket.send()
, but I am receiving the following error:
TypeError: 'str' object cannot be interpreted as an integer
is there a way to send this information without splitting the integer and string parts of the list?
edit*: the code looks as following:
list=[1,"a"]
HOST= '192.168.0.31' # Server IP or Hostname
PORT = 12345 # Pick an open Port (1000+ recommended), must match the server port
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST,PORT))
s.send(list)