Receiving Digital Output Values Using TCP/IP

I am trying to use TCP/IP using URCaps to get and set the values for the digital outputs. With the cobot as the server and the computer as the client using port 30002.
I use the command
socketConnection.send((“set_digital_out(0, True)”) + “\n”).encode(‘utf8’); for sending, which works correctly.
However, I wanted to ask which command do I use to receive the values for the digital output as a True/False.
I tried:
data = socketConnection.recv(1024); # 1024 is the buffer size of receiving the data
print(data.decode(“utf-8”)); but I get an error saying “UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xff in position 5: invalid start byte”.
I also am not sure how to specify that the data I want to receive is using get_digtal_out(n) method.