гугли.
LWrite('Prepare to work:',FOREGROUND_GREEN or FOREGROUND_INTENSITY,0);
Writeln('');
LWrite('=======================',FOREGROUND_GREEN or FOREGROUND_INTENSITY,0);
Writeln('');
LWrite('Create main socket:',FOREGROUND_RED or FOREGROUND_INTENSITY,0);
FCompPort:=TCompletionPort.Create(ClientThreadCount);
LWrite(' Ok',FOREGROUND_RED or FOREGROUND_INTENSITY,0);
Writeln('');
if FCompPort.FHandle<>0 then begin
LWrite('Initialise:',FOREGROUND_RED or FOREGROUND_INTENSITY,0);
WSAStartup($0101, WSAData);
LWrite(' Ok',FOREGROUND_RED or FOREGROUND_INTENSITY,0);
Writeln('');
LWrite('Create main threads:',FOREGROUND_RED or FOREGROUND_INTENSITY,0);
for i:=0 to ClientThreadCount-1 do TClientThread.Create(false);
TAcceptThread.Create(ListenPort);
LWrite(' Ok',FOREGROUND_RED or FOREGROUND_INTENSITY,0);
Writeln('');
LWrite('=======================',FOREGROUND_GREEN or FOREGROUND_INTENSITY,0);
Writeln('');
LWrite('Proxy activate',FOREGROUND_GREEN or FOREGROUND_INTENSITY,0);
Writeln('');
LWrite('=======================',FOREGROUND_GREEN or FOREGROUND_INTENSITY,0);
Writeln('');
repeat
ReadConsole(GetStdHandle(STD_INPUT_HANDLE),@Buff,10,Cnt,nil);
ConsoleText := String(Buff);
until UpperCase(Copy(ConsoleText,1,4)) = 'EXIT';
WSACleanup;
end;