⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 socketserver.pas

📁 一般的数据库管理系统 uses Classes, SConnectEx, TltConst, ExtCtrls, MMSystem, Types, windows, TltLogic , Sy
💻 PAS
字号:
unit SocketServer;

interface
uses ScktComp;
type
  TltSocketThread = class(TServerClientThread)
  private
  protected
    procedure ClientExecute; override;

  public
  end;
implementation

{ TltSocketThread }

procedure TltSocketThread.ClientExecute;
var
  Stream : TWinSocketStream;
  Buffer : array[0 .. 9] of Char;
begin
  { make sure connection is active }
  while (not Terminated) and ClientSocket.Connected do
  begin
    try
      Stream := TWinSocketStream.Create(ClientSocket, 60000);
      try
        FillChar(Buffer, 10, 0); { initialize the buffer }
        { give the client 60 seconds to start writing }
        if Stream.WaitForData(60000) then

        begin
          if Stream.Read(Buffer, 10) = 0 then { if can't read in 60 seconds }
            ClientSocket.Close;               { close the connection }
          { now process the request }
          //.//..
        end
        else
          ClientSocket.Close; { if client doesn't start, close }
      finally
        Stream.Free;
      end;
    except
      HandleException;
    end;

  end;

end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -