data = unpack('>L', sock.recv(4))
Does this line of code means, incoming data is big endian and so unpack to endianess of local machine and assign to data. If local machine is little endian, then big endian is automatically converted to little endian format?
The function "unpack" is not a built-in function. Does your code import some module at the top?