I have a Matlab script that sends a number in hexadecimal representation to a Python socket server. Then Python sends the same message back. 
Python receives: 3ff0000000000000.
But Matlab receives (using fread): 
51 102 102  48    48    48    48    48    48    48    48    48    48    48    48   48.
What does this mean? I can't figure out from Matlab's documentation what to do with those numbers. I've tried converting them to hexadecimal using mat2str and num2str but none of the results make sense to me.
These numbers are ASCII codes for.. the 3ff000000000.. 
Basically, what you are sending over the wire is a string, you need to interpret it as a hexadecimal number first.
Matlab fread from Python Socket