Advertisement
Guest User

client

a guest
Oct 18th, 2021
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. unit cc_TCPClient;
  2.  
  3. {$mode ObjFPC}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8. Classes, SysUtils, IdTCPClient, IdContext;
  9.  
  10. var
  11. cc_Client : TIdTCPClientCustom;
  12.  
  13. type
  14. cc_ClientEvent = class
  15. class procedure StartClient();
  16. class procedure OnConnected(AContext: TIdContext);
  17.  
  18. end;
  19.  
  20.  
  21. implementation
  22.  
  23. //Run When Connected
  24. class procedure cc_ClientEvent.OnConnected(AContext: TIdContext);
  25. begin
  26. //Send Client Hello/Connect
  27. end;
  28.  
  29.  
  30. //Start The Client Functions
  31. class procedure cc_ClientEvent.StartClient();
  32. begin
  33.  
  34. cc_Client := TIdTCPClient.Create();
  35.  
  36. cc_Client.Connect('localhost', 7000);
  37.  
  38. //cc_Client.
  39.  
  40. // cc_Client.OnConnected := @OnConnected;
  41. // cc_Client.;
  42.  
  43. cc_Client.IOHandler.Write('C');
  44. if (cc_Client.Connected = true) Then
  45. begin
  46. cc_Client.IOHandler.Write('C');
  47.  
  48. end
  49. else
  50. begin
  51. write('Error connecting...');
  52. readln();
  53. end;
  54.  
  55.  
  56.  
  57. end;
  58.  
  59.  
  60.  
  61. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement