fix recv: confusion between max and actual size of message
add shutdown method for sockets