The problem with your code is that violates strict aliasing rules and thus it's potentially unsafe.
You can either hide the warning with -Wno-strict-aliasing
(this won't solve your problem), modify your data structure or avoid the problem entirely by specifying position and length of your binary copy as Matt suggested (probably the best option):
unsigned int msgLength; memcpy(&msgLength, m_recvBuf, sizeof(msgLength)); msgLength = ntohl(msgLength);
Notice: I've not been getting the error with clang 3.4 and gcc 4.8.2 in -O3, that means the compiler might have optimized the warning away. Anyway that doesn't assure you your code is safe.