Fix PNet bugs

Fix potential deadlock if a timer fires just after we lock the mutex in sendMessage

Fix some casting errors in receiveMessage.
Fix receiveMessage discarding the whole packet when one message is discarded.
Add "stop" command that exits cleanly.
Update README.md
merge