Check for valid port and IP in receive method.