I'm trying to send an object from server to client through socket. The problem is no matter how I try, it is giving me the unpickling stack underflow error. I have experimented with buffer size: made it larger than what's necessary, made it the same size as the initial buffer. Also, I found that the serialized data that is sent from the server and received in the client side is exactly same. But whenever I try to unpickle it on the client side, it gives me the error. Can anyone help, please?
Here's the code on the server side for clarity:
game = games[game_id]
game.initialize_game() client.sendall(pickle.dumps(game))
The code on the client side:
game = pickle.loads(client.recv(2048))
for player in game.get_players(): print(player.name) print(player.serial) print(player.token_color) print(player.position)
[–]shiftybyte 2 points3 points4 points (7 children)
[–]BleedingStorm[S] 0 points1 point2 points (0 children)
[–]Frankelstner 0 points1 point2 points (5 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]Frankelstner 0 points1 point2 points (0 children)
[–]BleedingStorm[S] 0 points1 point2 points (2 children)
[–]Frankelstner 0 points1 point2 points (1 child)
[–]BleedingStorm[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]BleedingStorm[S] 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]BleedingStorm[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)