For(;;)
{
nBytes=-1;
If(test) nBytes=getCmdLineCommand(cmd);
// Manually sending commands from cmd line
Else if(remote) nBytes=getRemoteCommand(cmd);
// Receiving commands over TCP/IP
If(nBytes0) translateCmdToEventAndSen...(cmd)
if(lostConnectionWithClien()) waitForClient()
sleep(400);
}