hedgewars/uIO.pas
changeset 22 517be8dc5b76
parent 17 a6bed8d31444
child 37 2b7f2a43b999
equal deleted inserted replaced
21:dff476dcaaa3 22:517be8dc5b76
    86 end;
    86 end;
    87 
    87 
    88 procedure ParseIPCCommand(s: shortstring);
    88 procedure ParseIPCCommand(s: shortstring);
    89 begin
    89 begin
    90 case s[1] of
    90 case s[1] of
    91      '!': isPonged:= true;
    91      '!': begin {$IFDEF DEBUGFILE}AddFileLog('Ping? Pong!');{$ENDIF}isPonged:= true; end;
    92      '?': SendIPC('!');
    92      '?': SendIPC('!');
    93      'e': ParseCommand(copy(s, 2, Length(s) - 1));
    93      'e': ParseCommand(copy(s, 2, Length(s) - 1));
    94      'E': OutError(copy(s, 2, Length(s) - 1), true);
    94      'E': OutError(copy(s, 2, Length(s) - 1), true);
    95      'W': OutError(copy(s, 2, Length(s) - 1), false);
    95      'W': OutError(copy(s, 2, Length(s) - 1), false);
    96      'T': case s[2] of
    96      'T': case s[2] of
   143 end;
   143 end;
   144 
   144 
   145 procedure SendIPCAndWaitReply(s: shortstring);
   145 procedure SendIPCAndWaitReply(s: shortstring);
   146 begin
   146 begin
   147 SendIPC(s);
   147 SendIPC(s);
   148 s:= '?';
   148 SendIPC('?');
   149 SDLNet_TCP_Send(IPCSock, @s, Succ(byte(s[0])));
       
   150 isPonged:= false;
   149 isPonged:= false;
   151 repeat
   150 repeat
   152    IPCCheckSock;
   151    IPCCheckSock;
   153    SDL_Delay(1)
   152    SDL_Delay(1)
   154 until isPonged
   153 until isPonged