I'm trying to send complex variable amounts of data from my Python server to my Android client over a TCP socket.
Since I'm sending variable amounts of data, I'll have to prefix my data with the length of the message, and then on the Android side I'll have to read that prefix first, and then read those number of bytes as a stream.
Am I right?
So here's how I'm doing it on the Server(Python) side:
def send_msg(sock, msg):
msg = struct.pack('>I', len(msg)) + msg
sock.sendall(msg)
But my Java is pretty weak and I can't figure how to receive this on the client side.
Any help?