Checks for and dispatches any incoming messages. MaxTime is how long to wait if no data is ready to be read. This function is thread-safe and be called from a backfround thread manually or by callingStartReceiveThread()