dsockcli.pp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. Program Client;
  2. {
  3. $Id$
  4. This file is part of the Free Component Library (FCL)
  5. Copyright (c) 1999-2000 by the Free Pascal development team
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. {
  13. Dual socket client program. Before running this, run either
  14. 'isocksvr', 'dsocksvr' or 'dsocksvr -i' in another terminal
  15. or in the background.
  16. Make sure you run this with the same protocol as the server.
  17. }
  18. {$mode objfpc}{$H+}
  19. uses ssockets;
  20. Const
  21. TheSocket = 'ServerSoc';
  22. TheHost = 'localhost';
  23. ThePort = 4100;
  24. var
  25. Stream : TSocketStream;
  26. S : String;
  27. i : longint;
  28. begin
  29. S:='This is a textstring sent by the client'#10;
  30. If (ParamCount=1) and (paramstr(1)='-i') then
  31. Stream:=TInetSocket.Create(TheHost,ThePort)
  32. else
  33. Stream:=TUnixSocket.Create(TheSocket);
  34. With Stream do
  35. begin
  36. For I:=1 to 10 do
  37. Write(S[1],Length(S));
  38. S:='QUIT'#10;
  39. Write(S[1],Length(S));
  40. Free;
  41. end;
  42. end.
  43. $Log$
  44. Revision 1.5 2005-03-16 13:35:59 marco
  45. * some fixes for objfpc mode
  46. Revision 1.4 2005/02/14 17:13:18 peter
  47. * truncate log
  48. }