2
0

isockcli.pp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. Program Client;
  2. {
  3. This file is part of the Free Component Library (FCL)
  4. Copyright (c) 1999-2000 by the Free Pascal development team
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. {
  12. TInetSocket client program. Before running this, run either
  13. 'isocksvr' or 'dsocksvr -i' in another terminal or in the
  14. background.
  15. You can specify a connection timeout in milliseconds on the command-line:
  16. isockcli 1000
  17. will wait 1 second.
  18. }
  19. {$mode objfpc}{$H+}
  20. uses sysutils, ssockets;
  21. Const
  22. TheHost = 'localhost';
  23. ThePort = 4100;
  24. var
  25. S : String;
  26. i : longint;
  27. begin
  28. S:='This is a textstring sent by the client'#10;
  29. With TInetSocket.Create(TheHost,ThePort,StrToIntDef(ParamStr(1),0)) do
  30. begin
  31. For I:=1 to 10 do
  32. Write(S[1],Length(S));
  33. S:='QUIT'#10;
  34. Write(S[1],Length(S));
  35. Free;
  36. end;
  37. end.