hedgewars/fIPC.pas
author unc0rr
Sun, 04 Dec 2005 19:06:56 +0000
changeset 23 16322d14f068
parent 4 bcbd7adb4e4b
permissions -rw-r--r--
- Land generator uses templates to generate - Small fixes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
     1
(*
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
     2
 * Hedgewars, a worms-like game
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
     3
 * Copyright (c) 2004, 2005 Andrey Korotaev <unC0Rr@gmail.com>
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
     4
 *
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
     5
 * Distributed under the terms of the BSD-modified licence:
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
     6
 *
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
     7
 * Permission is hereby granted, free of charge, to any person obtaining a copy
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
     8
 * of this software and associated documentation files (the "Software"), to deal
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
     9
 * with the Software without restriction, including without limitation the
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    10
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    11
 * sell copies of the Software, and to permit persons to whom the Software is
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    12
 * furnished to do so, subject to the following conditions:
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    13
 *
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    14
 * 1. Redistributions of source code must retain the above copyright notice,
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    15
 *    this list of conditions and the following disclaimer.
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    16
 * 2. Redistributions in binary form must reproduce the above copyright notice,
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    17
 *    this list of conditions and the following disclaimer in the documentation
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    18
 *    and/or other materials provided with the distribution.
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    19
 * 3. The name of the author may not be used to endorse or promote products
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    20
 *    derived from this software without specific prior written permission.
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    21
 *
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    22
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    23
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    24
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    25
 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    26
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    27
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    28
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    29
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    30
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    31
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    32
 *)
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    33
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    34
unit fIPC;{$J+}
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    35
interface
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    36
uses Messages, WinSock, Windows;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    37
const
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    38
      IN_IPC_PORT  = 46631;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    39
      WM_ASYNC_IPCEVENT = WM_USER + 1;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    40
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    41
function InitIPCServer: boolean;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    42
procedure SendIPC(s: shortstring);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    43
procedure IPCEvent(sock: TSocket; lParam: LPARAM);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    44
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    45
var DemoFileName: string;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    46
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    47
implementation
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    48
uses fGUI, fMisc, fNet, uConsts, fGame, SysUtils, fConsts;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    49
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    50
var hIPCListenSockTCP : TSocket = INVALID_SOCKET;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    51
    hIPCServerSocket  : TSocket = INVALID_SOCKET;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    52
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    53
function InitIPCServer: boolean;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    54
var myaddrTCP: TSockAddrIn;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    55
    t: integer;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    56
begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    57
Result:= false;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    58
hIPCListenSockTCP:= socket(AF_INET, SOCK_STREAM, 0);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    59
myaddrTCP.sin_family      := AF_INET;
1
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    60
myaddrTCP.sin_addr.s_addr := $0100007F;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    61
myaddrTCP.sin_port        := htons(IN_IPC_PORT);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    62
t:= sizeof(TSockAddrIn);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    63
if (   bind(hIPCListenSockTCP, myaddrTCP, t) <> 0) then exit;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    64
if ( listen(hIPCListenSockTCP, 1)            <> 0) then exit;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    65
WSAAsyncSelect(hIPCListenSockTCP, hwndMain, WM_ASYNC_IPCEVENT, FD_ACCEPT or FD_READ or FD_CLOSE);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    66
Result:= true
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    67
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    68
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    69
procedure SendIPC(s: shortstring);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    70
begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    71
if hIPCServerSocket <> INVALID_SOCKET then
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    72
   begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    73
   send(hIPCServerSocket, s[0], Succ(byte(s[0])), 0);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    74
   if fWriteDemo then
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    75
      if not((Length(s) > 5) and (copy(s, 1, 5) = 'ebind')) then
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    76
         WriteRawToDemo(s)
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    77
   end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    78
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    79
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    80
procedure SendConfig;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    81
const cBufLength = $10000;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    82
{$INCLUDE revision.inc}
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    83
var f: file;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    84
    buf: array[0..Pred(cBufLength)] of byte;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    85
    i, t: integer;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    86
    s: shortstring;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    87
    sbuf:string;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    88
begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    89
SendIPC('WFrontend svn ' + cRevision);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    90
SendIPC(format('e$sound %d',[SendMessage(HSetSndCheck, BM_GETCHECK, 0, 0)]));
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    91
case GameType of
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    92
    gtLocal: begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    93
             SendIPC(format('e$gmflags %d',[0]));
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    94
             SendIPC('eaddteam');
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    95
             ExecCFG(Pathz[ptTeams] + 'unC0Rr.cfg');
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    96
             SendIPC('ecolor 65535');
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    97
             SendIPC('eadd hh0 0');
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    98
             SendIPC('eadd hh1 0');
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    99
             SendIPC('eadd hh2 0');
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   100
             SendIPC('eadd hh3 0');
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   101
             SendIPC('eaddteam');
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   102
             ExecCFG(Pathz[ptTeams] + 'test.cfg');
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   103
             SendIPC('eadd hh0 1');
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   104
             SendIPC('eadd hh1 1');
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   105
             SendIPC('eadd hh2 1');
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   106
             SendIPC('eadd hh3 1');
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   107
             SendIPC('ecolor 16776960');
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   108
             end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   109
     gtDemo: begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   110
             AssignFile(f, DemoFileName);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   111
             {$I-}
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   112
             Reset(f, 1);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   113
             if IOResult <> 0 then
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   114
                begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   115
                SendIPC('ECannot open file: "' + Pathz[ptDemos] + sbuf + '"');
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   116
                exit;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   117
                end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   118
             s:= 'TD';
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   119
             s[0]:= #6;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   120
             PLongWord(@s[3])^:= FileSize(f);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   121
             SendIPC(s);  // посылаем тип игры - демо и размер демки
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   122
             BlockRead(f, buf, cBufLength, t); // вырезаем seed
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   123
             i:= 0;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   124
             while (chr(buf[i]) <> cDemoSeedSeparator)and (i < t) do inc(i);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   125
             inc(i);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   126
             // посылаем остаток файла
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   127
             repeat
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   128
             while i < t do
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   129
                   begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   130
                   CopyMemory(@s[0], @buf[i], Succ(buf[i]));
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   131
                   SendIPC(s);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   132
                   inc(i, buf[i]);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   133
                   inc(i)
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   134
                   end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   135
             i:= 0;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   136
             BlockRead(f, buf, cBufLength, t);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   137
             until t = 0;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   138
             Closefile(f);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   139
             {$I+}
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   140
             end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   141
     gtNet: SendNet('C');
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   142
     end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   143
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   144
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   145
procedure ParseIPCCommand(s: shortstring);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   146
begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   147
case s[1] of
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   148
     '?': if GameType = gtNet then SendNet('?') else SendIPC('!');
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   149
     'C': SendConfig;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   150
     else if GameType = gtNet then SendNet(s);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   151
          if fWriteDemo and (s[1] <> '+') then WriteRawToDemo(s)
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   152
     end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   153
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   154
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   155
procedure IPCEvent(sock: TSocket; lParam: LPARAM);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   156
const sipc: string = '';
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   157
var WSAEvent: word;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   158
    i: integer;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   159
    buf: array[0..255] of byte;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   160
    s: shortstring absolute buf;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   161
begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   162
WSAEvent:= WSAGETSELECTEVENT(lParam);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   163
case WSAEvent of
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   164
   FD_CLOSE: begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   165
             closesocket(sock);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   166
             hIPCServerSocket:= INVALID_SOCKET;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   167
             exit
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   168
             end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   169
    FD_READ: begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   170
             repeat
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   171
             i:= recv(sock, buf[1], 255, 0);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   172
             if i > 0 then
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   173
                begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   174
                buf[0]:= i;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   175
                sipc:= sipc + s;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   176
                SplitStream2Commands(sipc, ParseIPCCommand);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   177
                end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   178
             until i < 1;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   179
             end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   180
 FD_ACCEPT:  hIPCServerSocket:= accept(hIPCListenSockTCP, nil, nil);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   181
   end
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   182
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   183
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   184
end.