case STAGE_ADDR: $cmd = ord($buffer[0]); if($cmd != CMD_CONNECT) { echo "bad cmd $cmd\n"; $connection->close(); return; ...