Fixed bug in receiveMessage function.
Verify that there are enough bytes to read on ctl socket, to avoid protocol errors.