├── .gitattributes ├── AndroidManifest.template.xml ├── Demos ├── ChatDemo │ ├── Client │ │ ├── ChatClient.dpr │ │ ├── ChatClient.dproj │ │ ├── ChatClient.dproj.local │ │ ├── ChatClient.dsk │ │ ├── ChatClient.identcache │ │ ├── ChatClient.res │ │ ├── ufrmMain.fmx │ │ └── ufrmMain.pas │ └── Server │ │ ├── ChatServer.dpr │ │ ├── ChatServer.dproj │ │ ├── ChatServer.dproj.local │ │ ├── ChatServer.dsk │ │ ├── ChatServer.identcache │ │ ├── ChatServer.res │ │ ├── ufrmMain.fmx │ │ └── ufrmMain.pas ├── DB │ ├── ChatDemo │ │ ├── Client │ │ │ ├── ChatClient.dpr │ │ │ ├── ChatClient.dproj │ │ │ ├── ChatClient.dproj.local │ │ │ ├── ChatClient.dsk │ │ │ ├── ChatClient.identcache │ │ │ ├── ChatClient.res │ │ │ ├── Initial.txt │ │ │ ├── ufrmMain.fmx │ │ │ └── ufrmMain.pas │ │ ├── Server │ │ │ └── Initial.txt │ │ └── initial.txt │ ├── DBClient │ │ ├── DBClient.dpr │ │ ├── DBClient.dproj │ │ ├── DBClient.dproj.local │ │ ├── DBClient.dsk │ │ ├── DBClient.identcache │ │ ├── DBClient.res │ │ ├── DBClient.skincfg │ │ ├── DBClient_Icon.ico │ │ ├── udmMain.dfm │ │ ├── udmMain.pas │ │ ├── ufrmMain.dfm │ │ └── ufrmMain.pas │ └── DBServer │ │ ├── Service │ │ ├── DBServerService.dpr │ │ ├── DBServerService.dproj │ │ ├── DBServerService.dproj.local │ │ ├── DBServerService.dsk │ │ ├── DBServerService.identcache │ │ ├── DBServerService.res │ │ ├── DBServerService.skincfg │ │ ├── DBServerService_Icon.ico │ │ ├── uscvServiceCommands.pas │ │ ├── usvcMain.dfm │ │ └── usvcMain.pas │ │ ├── ServiceApplication │ │ ├── DBServerApplication.dpr │ │ ├── DBServerApplication.dproj │ │ ├── DBServerApplication.dproj.local │ │ ├── DBServerApplication.dsk │ │ ├── DBServerApplication.identcache │ │ ├── DBServerApplication.res │ │ ├── DBServerApplication.skincfg │ │ ├── DBServerApplication_Icon.ico │ │ ├── ufrmMain.dfm │ │ └── ufrmMain.pas │ │ └── TestData │ │ └── Customers.mdb ├── NetComVSIndy │ ├── Client │ │ ├── NetComVSIndyClient.dpr │ │ ├── NetComVSIndyClient.dproj │ │ ├── NetComVSIndyClient.dproj.local │ │ ├── NetComVSIndyClient.dsk │ │ ├── NetComVSIndyClient.identcache │ │ ├── NetComVSIndyClient.res │ │ ├── ufrmMain.dfm │ │ └── ufrmMain.pas │ └── Server │ │ ├── NetComVSIndyServer.dpr │ │ ├── NetComVSIndyServer.dproj │ │ ├── NetComVSIndyServer.dproj.local │ │ ├── NetComVSIndyServer.dsk │ │ ├── NetComVSIndyServer.identcache │ │ ├── NetComVSIndyServer.res │ │ ├── ufrmMain.dfm │ │ └── ufrmMain.pas ├── SimpleSockets │ ├── Client │ │ ├── Client.dpr │ │ ├── Client.dproj │ │ ├── Client.dproj.local │ │ ├── Client.dsk │ │ ├── Client.identcache │ │ ├── Client.res │ │ ├── Client.skincfg │ │ ├── Client_Icon.ico │ │ ├── ufrmMain.dfm │ │ └── ufrmMain.pas │ ├── Server │ │ ├── Server.dpr │ │ ├── Server.dproj │ │ ├── Server.dproj.local │ │ ├── Server.dsk │ │ ├── Server.identcache │ │ ├── Server.res │ │ ├── Server.skincfg │ │ ├── Server_Icon.ico │ │ ├── ufrmMain.dfm │ │ └── ufrmMain.pas │ ├── SimpleSockets.groupproj │ ├── SimpleSockets_TCPv4.PNG │ └── SimpleSockets_TCPv6.PNG ├── SimpleSockets_UDP │ ├── Client │ │ ├── Client.dpr │ │ ├── Client.dproj │ │ ├── Client.dproj.local │ │ ├── Client.dsk │ │ ├── Client.identcache │ │ ├── Client.res │ │ ├── Client.skincfg │ │ ├── Client_Icon.ico │ │ ├── ufrmMain.dfm │ │ └── ufrmMain.pas │ ├── Server │ │ ├── Server.dpr │ │ ├── Server.dproj │ │ ├── Server.dproj.local │ │ ├── Server.dsk │ │ ├── Server.identcache │ │ ├── Server.res │ │ ├── Server.skincfg │ │ ├── Server_Icon.ico │ │ ├── ufrmMain.dfm │ │ └── ufrmMain.pas │ ├── SimpleSockets_UDP.groupproj │ ├── SimpleSockets_UDPv4.PNG │ └── SimpleSockets_UDPv6.PNG └── VideoChat │ ├── Client │ ├── AndroidManifest.template.xml │ ├── VideoChatClient.deployproj │ ├── VideoChatClient.dpr │ ├── VideoChatClient.dproj │ ├── VideoChatClient.dproj.local │ ├── VideoChatClient.dsk │ ├── VideoChatClient.identcache │ ├── VideoChatClient.res │ ├── ufrmMain.fmx │ └── ufrmMain.pas │ └── Server │ ├── AndroidManifest.template.xml │ ├── CommonCommands.pas │ ├── VideoChatServer.dpr │ ├── VideoChatServer.dproj │ ├── VideoChatServer.dproj.local │ ├── VideoChatServer.dsk │ ├── VideoChatServer.identcache │ ├── VideoChatServer.res │ ├── ufrmMain.fmx │ └── ufrmMain.pas ├── LICENSE ├── NetCom7.dpk ├── NetCom7.dproj ├── NetCom7.dproj.local ├── NetCom7.dres ├── NetCom7.dsk ├── NetCom7.identcache ├── NetCom7.res ├── NetCom7.skincfg ├── NetCom7.stat ├── NetCom7Resource.rc ├── PaletteIcons ├── TncIcon.bmp ├── TncIcon.png ├── tncudpclient.bmp └── tncudpserver.bmp ├── README.md ├── Source ├── Encryption │ ├── ncEncBlockciphers.pas │ ├── ncEncBlowfish.pas │ ├── ncEncCast128.pas │ ├── ncEncCast256.pas │ ├── ncEncCrypt2.pas │ ├── ncEncDes.pas │ ├── ncEncHaval.pas │ ├── ncEncIce.pas │ ├── ncEncIdea.pas │ ├── ncEncMars.pas │ ├── ncEncMd4.pas │ ├── ncEncMd5.pas │ ├── ncEncMisty1.pas │ ├── ncEncRc2.pas │ ├── ncEncRc4.pas │ ├── ncEncRc5.pas │ ├── ncEncRc6.pas │ ├── ncEncRijndael.pas │ ├── ncEncRipemd128.pas │ ├── ncEncRipemd160.pas │ ├── ncEncSerpent.pas │ ├── ncEncSha1.pas │ ├── ncEncSha256.pas │ ├── ncEncSha512.pas │ ├── ncEncTea.pas │ ├── ncEncTiger.pas │ └── ncEncTwofish.pas ├── NetComRegister.dcr ├── NetComRegister.pas ├── ncCommandHandlers.pas ├── ncCommandPacking.pas ├── ncCompression.pas ├── ncDBCnt.pas ├── ncDBCommands.pas ├── ncDBSrv.pas ├── ncEncryption.pas ├── ncIPUtils.pas ├── ncLines.pas ├── ncLines_v2.pas ├── ncPendingCommandsList.pas ├── ncSerializeADO.pas ├── ncSerializeValue.pas ├── ncSocketList.pas ├── ncSockets.pas ├── ncSources.pas ├── ncThreads.pas └── ncUDPSockets.pas ├── image-1.png └── image-2.png /.gitattributes: -------------------------------------------------------------------------------- 1 | # direct Delphi 2 | *.* linguist-language=Delphi 3 | -------------------------------------------------------------------------------- /AndroidManifest.template.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | <%uses-permission%> 12 | 13 | 21 | 22 | <%application-meta-data%> 23 | <%services%> 24 | 26 | 30 | 31 | 33 | 34 | 35 | 36 | 37 | 38 | <%activity%> 39 | <%receivers%> 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /Demos/ChatDemo/Client/ChatClient.dpr: -------------------------------------------------------------------------------- 1 | program ChatClient; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.Forms, 6 | ufrmMain in 'ufrmMain.pas' {frmMain}; 7 | 8 | {$R *.res} 9 | 10 | begin 11 | {$IFDEF DEBUG} 12 | ReportMemoryLeaksOnShutdown := True; 13 | {$ENDIF} 14 | Application.Initialize; 15 | Application.CreateForm(TfrmMain, frmMain); 16 | Application.Run; 17 | end. 18 | -------------------------------------------------------------------------------- /Demos/ChatDemo/Client/ChatClient.dproj.local: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 2018/09/21 12:49:51.000.179,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 5 | 2018/09/24 13:18:27.000.279,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 6 | 2018/10/10 13:56:06.000.238,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 7 | 2018/10/16 10:56:54.000.938,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 8 | 2018/10/16 11:40:09.000.191,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 9 | 2018/11/04 15:48:45.000.203,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 10 | 2018/11/04 16:17:18.000.148,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 11 | 2018/11/04 16:17:48.000.272,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 12 | 2018/11/23 20:02:18.000.772,=C:\Users\Programmer\Documents\Development\Projects\Unit2.pas 13 | 2019/02/27 18:05:16.000.392,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 14 | 2019/02/27 18:06:31.000.995,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 15 | 2019/02/27 18:12:19.000.197,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 16 | 2019/03/05 12:15:54.000.434,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 17 | 2019/03/05 13:06:38.000.677,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 18 | 2019/03/11 18:09:12.000.176,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 19 | 2019/03/25 16:12:14.000.258,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 20 | 2019/05/29 14:49:59.000.196,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 21 | 2019/05/31 18:08:29.000.138,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 22 | 2019/08/21 21:29:49.000.507,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 23 | 2019/09/18 13:39:12.000.759,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 24 | 2019/11/09 19:07:03.000.902,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 25 | 2019/12/15 14:13:57.000.985,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 26 | 2020/04/13 08:49:52.000.721,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 27 | 2020/04/14 04:39:08.000.542,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 28 | 2020/04/15 03:31:58.000.910,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 29 | 2020/06/01 10:58:58.000.571,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 30 | 2020/06/01 11:04:10.000.068,C:\Users\Programmer\Documents\Development\Projects\ChatDemo\Client\ufrmMain.fmx=C:\Users\Programmer\Documents\Development\Projects\Unit3.fmx 31 | 2020/06/01 11:04:10.000.068,C:\Users\Programmer\Documents\Development\Projects\ChatDemo\Client\ufrmMain.pas=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 32 | 2020/06/01 11:04:17.000.240,C:\Users\Programmer\Documents\Development\Projects\ChatDemo\Client\ChatDemoClient.dproj=C:\Users\Programmer\Documents\Development\Projects\Project1.dproj 33 | 2020/08/10 16:11:38.000.249,C:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\ChatDemo\Client\ChatClient.dproj=C:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\ChatDemo\Client\ChatDemoClient.dproj 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /Demos/ChatDemo/Client/ChatClient.identcache: -------------------------------------------------------------------------------- 1 | OD:\_Delphi\Netcom7\Original\NetCom7-master\Demos\ChatDemo\Client\ChatClient.dprMD:\_Delphi\Netcom7\Original\NetCom7-master\Demos\ChatDemo\Client\ufrmMain.pas -------------------------------------------------------------------------------- /Demos/ChatDemo/Client/ChatClient.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/Demos/ChatDemo/Client/ChatClient.res -------------------------------------------------------------------------------- /Demos/ChatDemo/Client/ufrmMain.fmx: -------------------------------------------------------------------------------- 1 | object frmMain: TfrmMain 2 | Left = 0 3 | Top = 0 4 | ActiveControl = edtText 5 | Caption = 'Chat Client' 6 | ClientHeight = 480 7 | ClientWidth = 640 8 | Position = ScreenCenter 9 | FormFactor.Width = 320 10 | FormFactor.Height = 480 11 | FormFactor.Devices = [Desktop] 12 | OnDestroy = FormDestroy 13 | DesignerMasterStyle = 0 14 | object memLog: TMemo 15 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 16 | DataDetectorTypes = [] 17 | ReadOnly = True 18 | TextSettings.WordWrap = True 19 | Align = Client 20 | Margins.Left = 5.000000000000000000 21 | Margins.Top = 5.000000000000000000 22 | Margins.Right = 5.000000000000000000 23 | Margins.Bottom = 5.000000000000000000 24 | Size.Width = 630.000000000000000000 25 | Size.Height = 369.000000000000000000 26 | Size.PlatformDefault = False 27 | TabOrder = 1 28 | Viewport.Width = 626.000000000000000000 29 | Viewport.Height = 365.000000000000000000 30 | end 31 | object ltMain: TLayout 32 | Align = Bottom 33 | Margins.Left = 5.000000000000000000 34 | Margins.Right = 5.000000000000000000 35 | Margins.Bottom = 5.000000000000000000 36 | Position.X = 5.000000000000000000 37 | Position.Y = 446.000000000000000000 38 | Size.Width = 630.000000000000000000 39 | Size.Height = 29.000000000000000000 40 | Size.PlatformDefault = False 41 | TabOrder = 3 42 | TabStop = False 43 | object edtText: TEdit 44 | Touch.InteractiveGestures = [LongTap, DoubleTap] 45 | Align = Client 46 | TabOrder = 0 47 | Margins.Right = 4.000000000000000000 48 | Size.Width = 546.000000000000000000 49 | Size.Height = 29.000000000000000000 50 | Size.PlatformDefault = False 51 | OnEnter = edtTextEnter 52 | OnExit = edtTextExit 53 | end 54 | object btnSend: TButton 55 | Align = Right 56 | Default = True 57 | Position.X = 550.000000000000000000 58 | Size.Width = 80.000000000000000000 59 | Size.Height = 29.000000000000000000 60 | Size.PlatformDefault = False 61 | TabOrder = 1 62 | Text = 'Send' 63 | OnClick = btnSendClick 64 | end 65 | end 66 | object edtClientName: TEdit 67 | Touch.InteractiveGestures = [LongTap, DoubleTap] 68 | Align = Bottom 69 | TabOrder = 2 70 | Text = 'Happy texter' 71 | Position.X = 5.000000000000000000 72 | Position.Y = 419.000000000000000000 73 | Margins.Left = 5.000000000000000000 74 | Margins.Right = 5.000000000000000000 75 | Margins.Bottom = 5.000000000000000000 76 | Size.Width = 630.000000000000000000 77 | Size.Height = 22.000000000000000000 78 | Size.PlatformDefault = False 79 | TextPrompt = 'Enter your name' 80 | end 81 | object ToolBar1: TToolBar 82 | Size.Width = 640.000000000000000000 83 | Size.Height = 40.000000000000000000 84 | Size.PlatformDefault = False 85 | TabOrder = 0 86 | TabStop = False 87 | object btnActivateClient: TButton 88 | Align = Left 89 | Margins.Left = 5.000000000000000000 90 | Margins.Top = 5.000000000000000000 91 | Margins.Right = 5.000000000000000000 92 | Margins.Bottom = 5.000000000000000000 93 | Position.X = 5.000000000000000000 94 | Position.Y = 5.000000000000000000 95 | Size.Width = 137.000000000000000000 96 | Size.Height = 30.000000000000000000 97 | Size.PlatformDefault = False 98 | TabOrder = 0 99 | Text = 'Activate Client' 100 | OnClick = btnActivateClientClick 101 | end 102 | object edtHost: TEdit 103 | Touch.InteractiveGestures = [LongTap, DoubleTap] 104 | Align = Client 105 | TabOrder = 1 106 | Text = 'LocalHost' 107 | Margins.Top = 5.000000000000000000 108 | Margins.Right = 5.000000000000000000 109 | Margins.Bottom = 5.000000000000000000 110 | Size.Width = 488.000000000000000000 111 | Size.Height = 30.000000000000000000 112 | Size.PlatformDefault = False 113 | OnChange = edtHostChange 114 | end 115 | end 116 | object Client: TncClientSource 117 | EncryptionKey = 'SetEncryptionKey' 118 | OnConnected = ClientConnected 119 | OnDisconnected = ClientDisconnected 120 | OnHandleCommand = ClientHandleCommand 121 | Host = 'LocalHost' 122 | OnReconnected = ClientReconnected 123 | Left = 32 124 | Top = 32 125 | end 126 | end 127 | -------------------------------------------------------------------------------- /Demos/ChatDemo/Client/ufrmMain.pas: -------------------------------------------------------------------------------- 1 | unit ufrmMain; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, 7 | FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls, 8 | FMX.Edit, FMX.Layouts, FMX.Controls.Presentation, FMX.ScrollBox, 9 | FMX.Memo, System.SyncObjs, ncSources; 10 | 11 | type 12 | TfrmMain = class(TForm) 13 | memLog: TMemo; 14 | ltMain: TLayout; 15 | edtText: TEdit; 16 | btnSend: TButton; 17 | Client: TncClientSource; 18 | edtClientName: TEdit; 19 | ToolBar1: TToolBar; 20 | btnActivateClient: TButton; 21 | edtHost: TEdit; 22 | procedure FormDestroy(Sender: TObject); 23 | procedure btnSendClick(Sender: TObject); 24 | function ClientHandleCommand(Sender: TObject; aLine: TncLine; aCmd: Integer; const aData: TArray; aRequiresResult: Boolean; 25 | const aSenderComponent, aReceiverComponent: string): TArray; 26 | procedure edtTextEnter(Sender: TObject); 27 | procedure edtTextExit(Sender: TObject); 28 | procedure btnActivateClientClick(Sender: TObject); 29 | procedure ClientConnected(Sender: TObject; aLine: TncLine); 30 | procedure ClientDisconnected(Sender: TObject; aLine: TncLine); 31 | procedure ClientReconnected(Sender: TObject; aLine: TncLine); 32 | procedure edtHostChange(Sender: TObject); 33 | private 34 | public 35 | procedure Log(aStr: string); 36 | end; 37 | 38 | var 39 | frmMain: TfrmMain; 40 | 41 | implementation 42 | 43 | {$R *.fmx} 44 | 45 | procedure TfrmMain.FormDestroy(Sender: TObject); 46 | begin 47 | Client.Active := False; 48 | end; 49 | 50 | procedure TfrmMain.Log(aStr: string); 51 | begin 52 | // This is thread safe 53 | TThread.Queue(nil, 54 | procedure 55 | begin 56 | memLog.Lines.Add(aStr); 57 | memLog.ScrollBy(0, 100); 58 | end); 59 | end; 60 | 61 | procedure TfrmMain.btnActivateClientClick(Sender: TObject); 62 | begin 63 | Client.Active := not Client.Active; 64 | end; 65 | 66 | procedure TfrmMain.btnSendClick(Sender: TObject); 67 | begin 68 | Client.ExecCommand(0, BytesOf(edtClientName.Text + ': ' + edtText.Text)); 69 | edtText.Text := ''; 70 | end; 71 | 72 | procedure TfrmMain.edtHostChange(Sender: TObject); 73 | begin 74 | Client.Host := edtHost.Text; 75 | end; 76 | 77 | procedure TfrmMain.edtTextEnter(Sender: TObject); 78 | begin 79 | btnSend.Default := True; 80 | end; 81 | 82 | procedure TfrmMain.edtTextExit(Sender: TObject); 83 | begin 84 | btnSend.Default := False; 85 | end; 86 | 87 | procedure TfrmMain.ClientConnected(Sender: TObject; aLine: TncLine); 88 | begin 89 | Log('Client connected to peer: ' + aLine.PeerIP); 90 | TThread.Queue(nil, 91 | procedure 92 | begin 93 | btnActivateClient.Text := 'Deactivate client'; 94 | end); 95 | end; 96 | 97 | procedure TfrmMain.ClientDisconnected(Sender: TObject; aLine: TncLine); 98 | begin 99 | Log('Client disconnected from peer: ' + aLine.PeerIP); 100 | TThread.Queue(nil, 101 | procedure 102 | begin 103 | btnActivateClient.Text := 'Activate client'; 104 | end); 105 | end; 106 | 107 | procedure TfrmMain.ClientReconnected(Sender: TObject; aLine: TncLine); 108 | begin 109 | Log('Client was reconnected to peer: ' + aLine.PeerIP); 110 | end; 111 | 112 | function TfrmMain.ClientHandleCommand(Sender: TObject; aLine: TncLine; aCmd: Integer; const aData: TArray; aRequiresResult: Boolean; 113 | const aSenderComponent, aReceiverComponent: string): TArray; 114 | begin 115 | Log(Stringof(aData)); 116 | end; 117 | 118 | end. 119 | -------------------------------------------------------------------------------- /Demos/ChatDemo/Server/ChatServer.dpr: -------------------------------------------------------------------------------- 1 | program ChatServer; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.Forms, 6 | ufrmMain in 'ufrmMain.pas' {frmMain}; 7 | 8 | {$R *.res} 9 | 10 | begin 11 | {$IFDEF DEBUG} 12 | ReportMemoryLeaksOnShutdown := True; 13 | {$ENDIF} 14 | Application.Initialize; 15 | Application.CreateForm(TfrmMain, frmMain); 16 | Application.Run; 17 | end. 18 | -------------------------------------------------------------------------------- /Demos/ChatDemo/Server/ChatServer.dproj.local: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 2018/09/21 12:49:51.000.179,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 5 | 2018/09/24 13:18:27.000.279,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 6 | 2018/10/10 13:56:06.000.238,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 7 | 2018/10/16 10:56:54.000.938,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 8 | 2018/10/16 11:40:09.000.191,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 9 | 2018/11/04 15:48:45.000.203,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 10 | 2018/11/04 16:17:18.000.148,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 11 | 2018/11/04 16:17:48.000.272,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 12 | 2018/11/23 20:02:18.000.772,=C:\Users\Programmer\Documents\Development\Projects\Unit2.pas 13 | 2019/02/27 18:05:16.000.392,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 14 | 2019/02/27 18:06:31.000.995,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 15 | 2019/02/27 18:12:19.000.197,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 16 | 2019/03/05 12:15:54.000.434,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 17 | 2019/03/05 13:06:38.000.677,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 18 | 2019/03/11 18:09:12.000.176,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 19 | 2019/03/25 16:12:14.000.258,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 20 | 2019/05/29 14:49:59.000.196,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 21 | 2019/05/31 18:08:29.000.138,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 22 | 2019/08/21 21:29:49.000.507,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 23 | 2019/09/18 13:39:12.000.759,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 24 | 2019/11/09 19:07:03.000.902,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 25 | 2019/12/15 14:13:57.000.985,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 26 | 2020/04/13 08:49:52.000.721,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 27 | 2020/04/14 04:39:08.000.542,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 28 | 2020/04/15 03:31:58.000.910,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 29 | 2020/07/02 09:58:25.000.183,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 30 | 2020/07/02 20:01:51.000.926,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 31 | 2020/07/05 15:55:38.000.562,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 32 | 2020/07/08 18:03:33.000.205,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 33 | 2020/07/16 00:09:13.000.392,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 34 | 2020/08/07 10:38:54.000.477,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 35 | 2020/08/08 10:30:32.000.363,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 36 | 2020/08/10 12:55:10.000.953,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 37 | 2020/08/10 12:57:08.000.980,C:\Users\Programmer\Documents\Development\Projects\Unit3.fmx=C:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\ChatDemo\Server\ufrmMain.fmx 38 | 2020/08/10 12:57:08.000.980,C:\Users\Programmer\Documents\Development\Projects\Unit3.pas=C:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\ChatDemo\Server\ufrmMain.pas 39 | 2020/08/10 12:57:13.000.964,C:\Users\Programmer\Documents\Development\Projects\Project1.dproj=C:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\ChatDemo\Server\ChatServer.dproj 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /Demos/ChatDemo/Server/ChatServer.identcache: -------------------------------------------------------------------------------- 1 | OD:\_Delphi\Netcom7\Original\NetCom7-master\Demos\ChatDemo\Server\ChatServer.dprMD:\_Delphi\Netcom7\Original\NetCom7-master\Demos\ChatDemo\Server\ufrmMain.pas -------------------------------------------------------------------------------- /Demos/ChatDemo/Server/ChatServer.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/Demos/ChatDemo/Server/ChatServer.res -------------------------------------------------------------------------------- /Demos/ChatDemo/Server/ufrmMain.fmx: -------------------------------------------------------------------------------- 1 | object frmMain: TfrmMain 2 | Left = 0 3 | Top = 0 4 | Caption = 'Chat Server' 5 | ClientHeight = 339 6 | ClientWidth = 583 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | OnDestroy = FormDestroy 11 | DesignerMasterStyle = 0 12 | object memLog: TMemo 13 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 14 | DataDetectorTypes = [] 15 | ReadOnly = True 16 | Align = Client 17 | Margins.Left = 5.000000000000000000 18 | Margins.Top = 5.000000000000000000 19 | Margins.Right = 5.000000000000000000 20 | Margins.Bottom = 5.000000000000000000 21 | Size.Width = 573.000000000000000000 22 | Size.Height = 289.000000000000000000 23 | Size.PlatformDefault = False 24 | TabOrder = 1 25 | Viewport.Width = 569.000000000000000000 26 | Viewport.Height = 285.000000000000000000 27 | end 28 | object ToolBar1: TToolBar 29 | Size.Width = 583.000000000000000000 30 | Size.Height = 40.000000000000000000 31 | Size.PlatformDefault = False 32 | TabOrder = 0 33 | TabStop = False 34 | object btnActivateServer: TButton 35 | Align = Left 36 | Margins.Left = 5.000000000000000000 37 | Margins.Top = 5.000000000000000000 38 | Margins.Bottom = 5.000000000000000000 39 | Position.X = 5.000000000000000000 40 | Position.Y = 5.000000000000000000 41 | Size.Width = 137.000000000000000000 42 | Size.Height = 30.000000000000000000 43 | Size.PlatformDefault = False 44 | TabOrder = 0 45 | Text = 'Activate Server' 46 | OnClick = btnActivateServerClick 47 | end 48 | object btnShutDownClients: TButton 49 | Align = Right 50 | Margins.Top = 5.000000000000000000 51 | Margins.Right = 5.000000000000000000 52 | Margins.Bottom = 5.000000000000000000 53 | Position.X = 424.000000000000000000 54 | Position.Y = 5.000000000000000000 55 | Size.Width = 154.000000000000000000 56 | Size.Height = 30.000000000000000000 57 | Size.PlatformDefault = False 58 | TabOrder = 2 59 | Text = 'Shutdown Clients' 60 | OnClick = btnShutDownClientsClick 61 | end 62 | end 63 | object Server: TncServerSource 64 | EncryptionKey = 'SetEncryptionKey' 65 | OnConnected = ServerConnected 66 | OnDisconnected = ServerDisconnected 67 | OnHandleCommand = ServerHandleCommand 68 | Left = 32 69 | Top = 32 70 | end 71 | end 72 | -------------------------------------------------------------------------------- /Demos/ChatDemo/Server/ufrmMain.pas: -------------------------------------------------------------------------------- 1 | unit ufrmMain; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, 7 | FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, 8 | FMX.StdCtrls, FMX.Controls.Presentation, FMX.ScrollBox, FMX.Memo, 9 | System.SyncObjs, ncSocketList, ncSources; 10 | 11 | type 12 | TfrmMain = class(TForm) 13 | Server: TncServerSource; 14 | memLog: TMemo; 15 | ToolBar1: TToolBar; 16 | btnActivateServer: TButton; 17 | btnShutDownClients: TButton; 18 | procedure FormDestroy(Sender: TObject); 19 | function ServerHandleCommand(Sender: TObject; aLine: TncLine; aCmd: Integer; const aData: TArray; aRequiresResult: Boolean; 20 | const aSenderComponent, aReceiverComponent: string): TArray; 21 | procedure ServerConnected(Sender: TObject; aLine: TncLine); 22 | procedure ServerDisconnected(Sender: TObject; aLine: TncLine); 23 | procedure btnActivateServerClick(Sender: TObject); 24 | procedure btnShutDownClientsClick(Sender: TObject); 25 | private 26 | public 27 | procedure Log(aStr: string); 28 | end; 29 | 30 | var 31 | frmMain: TfrmMain; 32 | 33 | implementation 34 | 35 | {$R *.fmx} 36 | 37 | procedure TfrmMain.FormDestroy(Sender: TObject); 38 | begin 39 | Server.Active := False; 40 | end; 41 | 42 | procedure TfrmMain.Log(aStr: string); 43 | begin 44 | // This is thread safe 45 | TThread.Queue(nil, 46 | procedure 47 | begin 48 | memLog.Lines.Add(aStr); 49 | memLog.ScrollBy(0, 100); 50 | end); 51 | end; 52 | 53 | procedure TfrmMain.btnActivateServerClick(Sender: TObject); 54 | begin 55 | try 56 | Server.Active := not Server.Active; 57 | finally 58 | if Server.Active then 59 | begin 60 | btnActivateServer.Text := 'Deactivate Server'; 61 | Log('Server is activated'); 62 | end 63 | else 64 | begin 65 | btnActivateServer.Text := 'Activate Server'; 66 | Log('Server was deactivated'); 67 | end; 68 | end; 69 | end; 70 | 71 | procedure TfrmMain.ServerConnected(Sender: TObject; aLine: TncLine); 72 | begin 73 | Log('Client connected: ' + aLine.PeerIP); 74 | end; 75 | 76 | procedure TfrmMain.ServerDisconnected(Sender: TObject; aLine: TncLine); 77 | begin 78 | Log('Client disconnected: ' + aLine.PeerIP); 79 | end; 80 | 81 | function TfrmMain.ServerHandleCommand(Sender: TObject; aLine: TncLine; aCmd: Integer; const aData: TArray; aRequiresResult: Boolean; 82 | const aSenderComponent, aReceiverComponent: string): TArray; 83 | var 84 | Clients: TSocketList; 85 | i: Integer; 86 | begin 87 | Log('Received: "' + StringOf(aData) + '" from peer: ' + aLine.PeerIP); 88 | 89 | // Now send this to all clients 90 | Clients := Server.Lines.LockList; 91 | try 92 | for i := 0 to Clients.Count - 1 do 93 | // if Clients.Lines[i] <> aLine then // If you do not want to send text back to original client 94 | Server.ExecCommand(Clients.Lines[i], 0, aData, False); 95 | 96 | // You can shutdown a line here by calling Server.ShutdownLine, 97 | // see following procecure 98 | finally 99 | Server.Lines.UnlockList; 100 | end; 101 | end; 102 | 103 | procedure TfrmMain.btnShutDownClientsClick(Sender: TObject); 104 | var 105 | Clients: TSocketList; 106 | i: Integer; 107 | begin 108 | Clients := Server.Lines.LockList; 109 | try 110 | for i := 0 to Clients.Count - 1 do 111 | Server.ShutDownLine(Clients.Lines[i]); 112 | finally 113 | Server.Lines.UnlockList; 114 | end; 115 | 116 | end; 117 | 118 | end. 119 | -------------------------------------------------------------------------------- /Demos/DB/ChatDemo/Client/ChatClient.dpr: -------------------------------------------------------------------------------- 1 | program ChatClient; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.Forms, 6 | ufrmMain in 'ufrmMain.pas' {frmMain}; 7 | 8 | {$R *.res} 9 | 10 | begin 11 | {$IFDEF DEBUG} 12 | ReportMemoryLeaksOnShutdown := True; 13 | {$ENDIF} 14 | Application.Initialize; 15 | Application.CreateForm(TfrmMain, frmMain); 16 | Application.Run; 17 | end. 18 | -------------------------------------------------------------------------------- /Demos/DB/ChatDemo/Client/ChatClient.dproj.local: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 2018/09/21 12:49:51.000.179,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 5 | 2018/09/24 13:18:27.000.279,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 6 | 2018/10/10 13:56:06.000.238,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 7 | 2018/10/16 10:56:54.000.938,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 8 | 2018/10/16 11:40:09.000.191,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 9 | 2018/11/04 15:48:45.000.203,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 10 | 2018/11/04 16:17:18.000.148,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 11 | 2018/11/04 16:17:48.000.272,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 12 | 2018/11/23 20:02:18.000.772,=C:\Users\Programmer\Documents\Development\Projects\Unit2.pas 13 | 2019/02/27 18:05:16.000.392,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 14 | 2019/02/27 18:06:31.000.995,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 15 | 2019/02/27 18:12:19.000.197,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 16 | 2019/03/05 12:15:54.000.434,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 17 | 2019/03/05 13:06:38.000.677,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 18 | 2019/03/11 18:09:12.000.176,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 19 | 2019/03/25 16:12:14.000.258,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 20 | 2019/05/29 14:49:59.000.196,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 21 | 2019/05/31 18:08:29.000.138,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 22 | 2019/08/21 21:29:49.000.507,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 23 | 2019/09/18 13:39:12.000.759,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 24 | 2019/11/09 19:07:03.000.902,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 25 | 2019/12/15 14:13:57.000.985,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 26 | 2020/04/13 08:49:52.000.721,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 27 | 2020/04/14 04:39:08.000.542,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 28 | 2020/04/15 03:31:58.000.910,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 29 | 2020/06/01 10:58:58.000.571,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 30 | 2020/06/01 11:04:10.000.068,C:\Users\Programmer\Documents\Development\Projects\ChatDemo\Client\ufrmMain.fmx=C:\Users\Programmer\Documents\Development\Projects\Unit3.fmx 31 | 2020/06/01 11:04:10.000.068,C:\Users\Programmer\Documents\Development\Projects\ChatDemo\Client\ufrmMain.pas=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 32 | 2020/06/01 11:04:17.000.240,C:\Users\Programmer\Documents\Development\Projects\ChatDemo\Client\ChatDemoClient.dproj=C:\Users\Programmer\Documents\Development\Projects\Project1.dproj 33 | 2020/08/10 16:11:38.249,C:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\ChatDemo\Client\ChatClient.dproj=C:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\ChatDemo\Client\ChatDemoClient.dproj 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /Demos/DB/ChatDemo/Client/ChatClient.identcache: -------------------------------------------------------------------------------- 1 | _C:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\ChatDemo\Client\ufrmMain.pasaC:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\ChatDemo\Client\ChatClient.dpr -------------------------------------------------------------------------------- /Demos/DB/ChatDemo/Client/ChatClient.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/Demos/DB/ChatDemo/Client/ChatClient.res -------------------------------------------------------------------------------- /Demos/DB/ChatDemo/Client/Initial.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Demos/DB/ChatDemo/Client/ufrmMain.fmx: -------------------------------------------------------------------------------- 1 | object frmMain: TfrmMain 2 | Left = 0 3 | Top = 0 4 | ActiveControl = edtText 5 | Caption = 'Chat Client' 6 | ClientHeight = 480 7 | ClientWidth = 640 8 | Position = ScreenCenter 9 | FormFactor.Width = 320 10 | FormFactor.Height = 480 11 | FormFactor.Devices = [Desktop] 12 | OnCreate = FormCreate 13 | OnDestroy = FormDestroy 14 | DesignerMasterStyle = 0 15 | object memLog: TMemo 16 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 17 | DataDetectorTypes = [] 18 | ReadOnly = True 19 | TextSettings.WordWrap = True 20 | Align = Client 21 | Margins.Left = 5.000000000000000000 22 | Margins.Top = 5.000000000000000000 23 | Margins.Right = 5.000000000000000000 24 | Margins.Bottom = 5.000000000000000000 25 | Size.Width = 630.000000000000000000 26 | Size.Height = 369.000000000000000000 27 | Size.PlatformDefault = False 28 | TabOrder = 1 29 | Viewport.Width = 626.000000000000000000 30 | Viewport.Height = 365.000000000000000000 31 | end 32 | object ltMain: TLayout 33 | Align = Bottom 34 | Margins.Left = 5.000000000000000000 35 | Margins.Right = 5.000000000000000000 36 | Margins.Bottom = 5.000000000000000000 37 | Position.X = 5.000000000000000000 38 | Position.Y = 446.000000000000000000 39 | Size.Width = 630.000000000000000000 40 | Size.Height = 29.000000000000000000 41 | Size.PlatformDefault = False 42 | TabOrder = 3 43 | TabStop = False 44 | object edtText: TEdit 45 | Touch.InteractiveGestures = [LongTap, DoubleTap] 46 | Align = Client 47 | TabOrder = 0 48 | Margins.Right = 4.000000000000000000 49 | Size.Width = 546.000000000000000000 50 | Size.Height = 29.000000000000000000 51 | Size.PlatformDefault = False 52 | OnEnter = edtTextEnter 53 | OnExit = edtTextExit 54 | end 55 | object btnSend: TButton 56 | Align = Right 57 | Default = True 58 | Position.X = 550.000000000000000000 59 | Size.Width = 80.000000000000000000 60 | Size.Height = 29.000000000000000000 61 | Size.PlatformDefault = False 62 | TabOrder = 1 63 | Text = 'Send' 64 | OnClick = btnSendClick 65 | end 66 | end 67 | object edtClientName: TEdit 68 | Touch.InteractiveGestures = [LongTap, DoubleTap] 69 | Align = Bottom 70 | TabOrder = 2 71 | Text = 'Happy texter' 72 | Position.X = 5.000000000000000000 73 | Position.Y = 419.000000000000000000 74 | Margins.Left = 5.000000000000000000 75 | Margins.Right = 5.000000000000000000 76 | Margins.Bottom = 5.000000000000000000 77 | Size.Width = 630.000000000000000000 78 | Size.Height = 22.000000000000000000 79 | Size.PlatformDefault = False 80 | TextPrompt = 'Enter your name' 81 | end 82 | object tmrUpdateLog: TTimer 83 | Interval = 1 84 | OnTimer = tmrUpdateLogTimer 85 | Left = 96 86 | Top = 32 87 | end 88 | object ToolBar1: TToolBar 89 | Size.Width = 640.000000000000000000 90 | Size.Height = 40.000000000000000000 91 | Size.PlatformDefault = False 92 | TabOrder = 0 93 | TabStop = False 94 | object btnActivateClient: TButton 95 | Align = Left 96 | Margins.Left = 5.000000000000000000 97 | Margins.Top = 5.000000000000000000 98 | Margins.Right = 5.000000000000000000 99 | Margins.Bottom = 5.000000000000000000 100 | Position.X = 5.000000000000000000 101 | Position.Y = 5.000000000000000000 102 | Size.Width = 137.000000000000000000 103 | Size.Height = 30.000000000000000000 104 | Size.PlatformDefault = False 105 | TabOrder = 0 106 | Text = 'Activate Client' 107 | OnClick = btnActivateClientClick 108 | end 109 | object edtHost: TEdit 110 | Touch.InteractiveGestures = [LongTap, DoubleTap] 111 | Align = Client 112 | TabOrder = 1 113 | Text = 'LocalHost' 114 | Margins.Top = 5.000000000000000000 115 | Margins.Right = 5.000000000000000000 116 | Margins.Bottom = 5.000000000000000000 117 | Size.Width = 488.000000000000000000 118 | Size.Height = 30.000000000000000000 119 | Size.PlatformDefault = False 120 | OnChange = edtHostChange 121 | end 122 | end 123 | object Client: TncClientSource 124 | EncryptionKey = 'SetEncryptionKey' 125 | OnConnected = ClientConnected 126 | OnDisconnected = ClientDisconnected 127 | OnHandleCommand = ClientHandleCommand 128 | Host = 'LocalHost' 129 | OnReconnected = ClientReconnected 130 | Left = 32 131 | Top = 32 132 | end 133 | end 134 | -------------------------------------------------------------------------------- /Demos/DB/ChatDemo/Client/ufrmMain.pas: -------------------------------------------------------------------------------- 1 | unit ufrmMain; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, 7 | FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls, 8 | FMX.Edit, FMX.Layouts, FMX.Controls.Presentation, FMX.ScrollBox, 9 | FMX.Memo, System.SyncObjs, ncSources; 10 | 11 | type 12 | TfrmMain = class(TForm) 13 | memLog: TMemo; 14 | ltMain: TLayout; 15 | edtText: TEdit; 16 | btnSend: TButton; 17 | Client: TncClientSource; 18 | tmrUpdateLog: TTimer; 19 | edtClientName: TEdit; 20 | ToolBar1: TToolBar; 21 | btnActivateClient: TButton; 22 | edtHost: TEdit; 23 | procedure FormCreate(Sender: TObject); 24 | procedure FormDestroy(Sender: TObject); 25 | procedure btnSendClick(Sender: TObject); 26 | procedure tmrUpdateLogTimer(Sender: TObject); 27 | function ClientHandleCommand(Sender: TObject; aLine: TncLine; aCmd: Integer; 28 | const aData: TArray; aRequiresResult: Boolean; 29 | const aSenderComponent, aReceiverComponent: string): TArray; 30 | procedure edtTextEnter(Sender: TObject); 31 | procedure edtTextExit(Sender: TObject); 32 | procedure btnActivateClientClick(Sender: TObject); 33 | procedure ClientConnected(Sender: TObject; aLine: TncLine); 34 | procedure ClientDisconnected(Sender: TObject; aLine: TncLine); 35 | procedure ClientReconnected(Sender: TObject; aLine: TncLine); 36 | procedure edtHostChange(Sender: TObject); 37 | private 38 | LogLock: TCriticalSection; 39 | LogLines, LogLinesCopy: TStringList; 40 | public 41 | procedure Log(aStr: string); 42 | end; 43 | 44 | var 45 | frmMain: TfrmMain; 46 | 47 | implementation 48 | 49 | {$R *.fmx} 50 | 51 | procedure TfrmMain.FormCreate(Sender: TObject); 52 | begin 53 | LogLock := TCriticalSection.Create; 54 | LogLines := TStringList.Create; 55 | LogLinesCopy := TStringList.Create; 56 | end; 57 | 58 | procedure TfrmMain.FormDestroy(Sender: TObject); 59 | begin 60 | Client.Active := False; 61 | 62 | LogLinesCopy.Free; 63 | LogLines.Free; 64 | LogLock.Free; 65 | end; 66 | 67 | procedure TfrmMain.Log(aStr: string); 68 | begin 69 | // This is thread safe 70 | LogLock.Acquire; 71 | try 72 | LogLines.Add (aStr); 73 | finally 74 | LogLock.Release; 75 | end; 76 | end; 77 | 78 | procedure TfrmMain.tmrUpdateLogTimer(Sender: TObject); 79 | var 80 | i: Integer; 81 | begin 82 | // Update the memLog from LogLines 83 | LogLock.Acquire; 84 | try 85 | LogLinesCopy.Assign(LogLines); 86 | LogLines.Clear; 87 | finally 88 | LogLock.Release; 89 | end; 90 | 91 | for i := 0 to LogLinesCopy.Count - 1 do 92 | begin 93 | memLog.Lines.Add(LogLinesCopy.Strings[i]); 94 | memLog.SelStart := Length(memLog.Text); 95 | end; 96 | LogLinesCopy.Clear; 97 | end; 98 | 99 | procedure TfrmMain.btnActivateClientClick(Sender: TObject); 100 | begin 101 | Client.Active := not Client.Active; 102 | end; 103 | 104 | procedure TfrmMain.btnSendClick(Sender: TObject); 105 | begin 106 | Client.ExecCommand(0, BytesOf (edtClientName.Text + ': ' + edtText.Text)); 107 | edtText.Text := ''; 108 | end; 109 | 110 | procedure TfrmMain.edtHostChange(Sender: TObject); 111 | begin 112 | if not Client.Active then 113 | Client.Host := edtHost.Text; 114 | end; 115 | 116 | procedure TfrmMain.edtTextEnter(Sender: TObject); 117 | begin 118 | btnSend.Default := True; 119 | end; 120 | 121 | procedure TfrmMain.edtTextExit(Sender: TObject); 122 | begin 123 | btnSend.Default := False; 124 | end; 125 | 126 | procedure TfrmMain.ClientConnected(Sender: TObject; aLine: TncLine); 127 | begin 128 | Log ('Client connected to peer: ' + aLine.PeerIP); 129 | TThread.Synchronize(nil, 130 | procedure 131 | begin 132 | btnActivateClient.Text := 'Deactivate client'; 133 | end); 134 | end; 135 | 136 | procedure TfrmMain.ClientDisconnected(Sender: TObject; aLine: TncLine); 137 | begin 138 | Log ('Client disconnected from peer: ' + aLine.PeerIP); 139 | TThread.Synchronize(nil, 140 | procedure 141 | begin 142 | btnActivateClient.Text := 'Activate client'; 143 | end); 144 | end; 145 | 146 | procedure TfrmMain.ClientReconnected(Sender: TObject; aLine: TncLine); 147 | begin 148 | Log ('Client was reconnected to peer: ' + aLine.PeerIP); 149 | end; 150 | 151 | function TfrmMain.ClientHandleCommand(Sender: TObject; aLine: TncLine; 152 | aCmd: Integer; const aData: TArray; aRequiresResult: Boolean; 153 | const aSenderComponent, aReceiverComponent: string): TArray; 154 | begin 155 | Log (Stringof (aData)); 156 | end; 157 | 158 | end. 159 | -------------------------------------------------------------------------------- /Demos/DB/ChatDemo/Server/Initial.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Demos/DB/ChatDemo/initial.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Demos/DB/DBClient/DBClient.dpr: -------------------------------------------------------------------------------- 1 | program DBClient; 2 | 3 | uses 4 | Vcl.Forms, 5 | ufrmMain in 'ufrmMain.pas' {frmMain}, 6 | udmMain in 'udmMain.pas' {dmMain: TDataModule}; 7 | 8 | {$R *.res} 9 | 10 | begin 11 | ReportMemoryLeaksOnShutdown := True; 12 | Application.Initialize; 13 | Application.MainFormOnTaskbar := True; 14 | Application.CreateForm(TfrmMain, frmMain); 15 | Application.CreateForm(TdmMain, dmMain); 16 | Application.Run; 17 | end. 18 | -------------------------------------------------------------------------------- /Demos/DB/DBClient/DBClient.dproj.local: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 2011/03/28 11:31:42.844.dfm,C:\Users\BDemos\Documents\RAD Studio\Projects\Unit1.dfm=C:\Users\BDemos\Documents\RAD Studio\Components\NetCom7\Demos\DB\DBClient\ufrmMain.dfm 5 | 2011/03/28 11:31:42.844.pas,C:\Users\BDemos\Documents\RAD Studio\Projects\Unit1.pas=C:\Users\BDemos\Documents\RAD Studio\Components\NetCom7\Demos\DB\DBClient\ufrmMain.pas 6 | 2011/03/28 11:31:46.702.dproj,C:\Users\BDemos\Documents\RAD Studio\Projects\Project1.dproj=C:\Users\BDemos\Documents\RAD Studio\Components\NetCom7\Demos\DB\DBClient\DBClient.dproj 7 | 2011/03/28 11:32:45.130.dfm,C:\Users\BDemos\Documents\RAD Studio\Components\NetCom7\Demos\DB\DBClient\Unit1.dfm=C:\Users\BDemos\Documents\RAD Studio\Components\NetCom7\Demos\DB\DBClient\udmMain.dfm 8 | 2011/03/28 11:32:45.130.pas,C:\Users\BDemos\Documents\RAD Studio\Components\NetCom7\Demos\DB\DBClient\Unit1.pas=C:\Users\BDemos\Documents\RAD Studio\Components\NetCom7\Demos\DB\DBClient\udmMain.pas 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Demos/DB/DBClient/DBClient.identcache: -------------------------------------------------------------------------------- 1 | [C:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\DB\DBClient\DBClient.dprFc:\program files (x86)\embarcadero\studio\20.0\source\data\Data.DB.pasQc:\program files (x86)\embarcadero\studio\20.0\SOURCE\RTL\SYS\System.SysUtils.pas[C:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\DB\DBClient\ufrmMain.pasSc:\program files (x86)\embarcadero\studio\20.0\source\rtl\common\System.Classes.pasZC:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\DB\DBClient\udmMain.pasQc:\program files (x86)\embarcadero\studio\20.0\source\data\ado\Data.Win.ADODB.pas -------------------------------------------------------------------------------- /Demos/DB/DBClient/DBClient.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/Demos/DB/DBClient/DBClient.res -------------------------------------------------------------------------------- /Demos/DB/DBClient/DBClient.skincfg: -------------------------------------------------------------------------------- 1 | [ExpressSkins] 2 | Default=1 3 | ShowNotifications=1 4 | Enabled=1 5 | dxSkinBlack=0 6 | dxSkinBlue=0 7 | dxSkinCaramel=0 8 | dxSkinCoffee=0 9 | dxSkinDarkRoom=0 10 | dxSkinDarkSide=0 11 | dxSkinFoggy=0 12 | dxSkinGlassOceans=0 13 | dxSkiniMaginary=0 14 | dxSkinLilian=0 15 | dxSkinLiquidSky=0 16 | dxSkinLondonLiquidSky=0 17 | dxSkinMcSkin=0 18 | dxSkinMoneyTwins=0 19 | dxSkinOffice2007Black=0 20 | dxSkinOffice2007Blue=0 21 | dxSkinOffice2007Green=0 22 | dxSkinOffice2007Pink=0 23 | dxSkinOffice2007Silver=0 24 | dxSkinPumpkin=0 25 | dxSkinSeven=0 26 | dxSkinSharp=0 27 | dxSkinSilver=0 28 | dxSkinSpringTime=0 29 | dxSkinStardust=0 30 | dxSkinSummer2008=0 31 | dxSkinsDefaultPainters=0 32 | dxSkinValentine=0 33 | dxSkinXmas2008Blue=0 34 | -------------------------------------------------------------------------------- /Demos/DB/DBClient/DBClient_Icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/Demos/DB/DBClient/DBClient_Icon.ico -------------------------------------------------------------------------------- /Demos/DB/DBClient/udmMain.dfm: -------------------------------------------------------------------------------- 1 | object dmMain: TdmMain 2 | OldCreateOrder = False 3 | OnCreate = DataModuleCreate 4 | Height = 351 5 | Width = 376 6 | object ncClientSource: TncClientSource 7 | Port = 18753 8 | EncryptionKey = 'SetEncryptionKey' 9 | Host = 'localhost' 10 | Left = 56 11 | Top = 36 12 | end 13 | object ncDBDataset1: TncDBDataset 14 | CursorType = ctStatic 15 | LockType = ltBatchOptimistic 16 | Source = ncClientSource 17 | PeerCommandHandler = 'DBServer' 18 | SQL.Strings = ( 19 | 'select * from Customers') 20 | Parameters = <> 21 | Left = 112 22 | Top = 116 23 | end 24 | object DataSource1: TDataSource 25 | DataSet = ncDBDataset1 26 | Left = 196 27 | Top = 116 28 | end 29 | object ncDBDataset2: TncDBDataset 30 | CursorType = ctStatic 31 | LockType = ltBatchOptimistic 32 | Source = ncClientSource 33 | PeerCommandHandler = 'DBServer' 34 | SQL.Strings = ( 35 | 'select * from Orders' 36 | 'where FKCustomersID=:ID') 37 | DataSource = DataSource1 38 | IndexFieldNames = 'FKCustomersID' 39 | Parameters = < 40 | item 41 | Name = 'ID' 42 | Size = -1 43 | Value = Null 44 | end> 45 | Left = 112 46 | Top = 184 47 | end 48 | object DataSource2: TDataSource 49 | DataSet = ncDBDataset2 50 | Left = 196 51 | Top = 184 52 | end 53 | object ADOQuery1: TADOQuery 54 | Parameters = <> 55 | Left = 56 56 | Top = 276 57 | end 58 | end 59 | -------------------------------------------------------------------------------- /Demos/DB/DBClient/udmMain.pas: -------------------------------------------------------------------------------- 1 | unit udmMain; 2 | 3 | interface 4 | 5 | uses 6 | System.Classes, System.SysUtils, Data.DB, Data.Win.ADODB, ncSockets, ncSources, ncDBCnt; 7 | 8 | type 9 | TdmMain = class(TDataModule) 10 | ncClientSource: TncClientSource; 11 | ncDBDataset1: TncDBDataset; 12 | DataSource1: TDataSource; 13 | ncDBDataset2: TncDBDataset; 14 | DataSource2: TDataSource; 15 | ADOQuery1: TADOQuery; 16 | procedure DataModuleCreate(Sender: TObject); 17 | private 18 | { Private declarations } 19 | public 20 | { Public declarations } 21 | end; 22 | 23 | var 24 | dmMain: TdmMain; 25 | 26 | implementation 27 | 28 | uses ufrmMain; 29 | 30 | {$R *.dfm} 31 | 32 | procedure TdmMain.DataModuleCreate(Sender: TObject); 33 | begin 34 | ncDBDataset1.Active := True; 35 | ncDBDataset2.Active := True; 36 | end; 37 | 38 | end. 39 | -------------------------------------------------------------------------------- /Demos/DB/DBClient/ufrmMain.dfm: -------------------------------------------------------------------------------- 1 | object frmMain: TfrmMain 2 | Left = 0 3 | Top = 0 4 | Caption = 'Client DB Tester' 5 | ClientHeight = 392 6 | ClientWidth = 945 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | PixelsPerInch = 96 15 | TextHeight = 13 16 | object Panel2: TPanel 17 | Left = 245 18 | Top = 0 19 | Width = 700 20 | Height = 373 21 | Align = alClient 22 | TabOrder = 2 23 | object dbGrid1: TDBGrid 24 | AlignWithMargins = True 25 | Left = 4 26 | Top = 4 27 | Width = 692 28 | Height = 150 29 | Align = alTop 30 | DataSource = dmMain.DataSource1 31 | TabOrder = 0 32 | TitleFont.Charset = DEFAULT_CHARSET 33 | TitleFont.Color = clWindowText 34 | TitleFont.Height = -11 35 | TitleFont.Name = 'Tahoma' 36 | TitleFont.Style = [] 37 | end 38 | object DBNavigator1: TDBNavigator 39 | AlignWithMargins = True 40 | Left = 4 41 | Top = 160 42 | Width = 692 43 | Height = 35 44 | DataSource = dmMain.DataSource1 45 | Align = alTop 46 | TabOrder = 1 47 | end 48 | object DBGrid2: TDBGrid 49 | AlignWithMargins = True 50 | Left = 4 51 | Top = 201 52 | Width = 692 53 | Height = 130 54 | Align = alClient 55 | DataSource = dmMain.DataSource2 56 | TabOrder = 2 57 | TitleFont.Charset = DEFAULT_CHARSET 58 | TitleFont.Color = clWindowText 59 | TitleFont.Height = -11 60 | TitleFont.Name = 'Tahoma' 61 | TitleFont.Style = [] 62 | end 63 | object DBNavigator2: TDBNavigator 64 | AlignWithMargins = True 65 | Left = 4 66 | Top = 337 67 | Width = 692 68 | Height = 32 69 | DataSource = dmMain.DataSource2 70 | Align = alBottom 71 | TabOrder = 3 72 | end 73 | end 74 | object StatusBar: TStatusBar 75 | Left = 0 76 | Top = 373 77 | Width = 945 78 | Height = 19 79 | Panels = <> 80 | SimplePanel = True 81 | end 82 | object Panel1: TPanel 83 | Left = 0 84 | Top = 0 85 | Width = 245 86 | Height = 373 87 | Align = alLeft 88 | TabOrder = 0 89 | object Button1: TButton 90 | Left = 6 91 | Top = 52 92 | Width = 219 93 | Height = 25 94 | Caption = 'Test Activate/Deactivate Recordset Cycle' 95 | TabOrder = 0 96 | OnClick = Button1Click 97 | end 98 | object Button2: TButton 99 | Left = 6 100 | Top = 111 101 | Width = 219 102 | Height = 25 103 | Caption = 'Test Requery' 104 | TabOrder = 1 105 | OnClick = Button2Click 106 | end 107 | object cbShowOpenClose: TCheckBox 108 | Left = 12 109 | Top = 83 110 | Width = 213 111 | Height = 17 112 | Caption = 'Show Open/Close' 113 | TabOrder = 2 114 | end 115 | object Button4: TButton 116 | Left = 6 117 | Top = 230 118 | Width = 161 119 | Height = 45 120 | Caption = 'Filter Pending' 121 | TabOrder = 3 122 | OnClick = Button4Click 123 | end 124 | object edtHost: TEdit 125 | Left = 6 126 | Top = 10 127 | Width = 121 128 | Height = 21 129 | TabOrder = 4 130 | Text = 'LocalHost' 131 | TextHint = 'Host' 132 | OnChange = edtHostChange 133 | end 134 | object btnApplyUpdates: TButton 135 | Left = 6 136 | Top = 281 137 | Width = 161 138 | Height = 45 139 | Caption = 'Apply Updates' 140 | TabOrder = 5 141 | OnClick = btnApplyUpdatesClick 142 | end 143 | end 144 | end 145 | -------------------------------------------------------------------------------- /Demos/DB/DBClient/ufrmMain.pas: -------------------------------------------------------------------------------- 1 | unit ufrmMain; 2 | 3 | interface 4 | 5 | uses 6 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 7 | Dialogs, udmMain, DBCtrls, ExtCtrls, Grids, DBGrids, StdCtrls, ncSockets, ncDBCnt, 8 | ComCtrls, ADOInt, ADODB, Data.DB; 9 | 10 | type 11 | TfrmMain = class(TForm) 12 | StatusBar: TStatusBar; 13 | Panel1: TPanel; 14 | Panel2: TPanel; 15 | dbGrid1: TDBGrid; 16 | DBNavigator1: TDBNavigator; 17 | DBGrid2: TDBGrid; 18 | DBNavigator2: TDBNavigator; 19 | Button1: TButton; 20 | Button2: TButton; 21 | cbShowOpenClose: TCheckBox; 22 | Button4: TButton; 23 | edtHost: TEdit; 24 | btnApplyUpdates: TButton; 25 | procedure Button1Click(Sender: TObject); 26 | procedure Button2Click(Sender: TObject); 27 | procedure Button4Click(Sender: TObject); 28 | procedure edtHostChange(Sender: TObject); 29 | procedure btnApplyUpdatesClick(Sender: TObject); 30 | private 31 | { Private declarations } 32 | public 33 | { Public declarations } 34 | end; 35 | 36 | var 37 | frmMain: TfrmMain; 38 | 39 | implementation 40 | 41 | {$R *.dfm} 42 | 43 | var 44 | InButton1: Boolean = False; 45 | PrevBtn1Cap: string; 46 | 47 | procedure TfrmMain.Button1Click(Sender: TObject); 48 | var 49 | TimeStart, TimeEnd: Int64; 50 | 51 | Freq: Int64; 52 | i: Integer; 53 | begin 54 | if InButton1 then 55 | begin 56 | Button1.Caption := PrevBtn1Cap; 57 | 58 | InButton1 := False; 59 | Exit; 60 | end; 61 | 62 | // Test n alive queries 63 | InButton1 := True; 64 | try 65 | PrevBtn1Cap := Button1.Caption; 66 | Button1.Caption := 'Stop'; 67 | 68 | if not cbShowOpenClose.Checked then 69 | begin 70 | dmMain.DataSource1.DataSet := nil; 71 | dmMain.DataSource2.DataSet := nil; 72 | end; 73 | try 74 | QueryPerformanceFrequency(Freq); 75 | QueryPerformanceCounter(TimeStart); 76 | i := 0; 77 | while InButton1 and not Application.Terminated do 78 | begin 79 | i := i + 1; 80 | if i mod 100 = 0 then 81 | begin 82 | StatusBar.SimpleText := Format('Iteration: %4.4d, Mean Open/Close Time: %f (ms)', [i, 1000 * (TimeEnd - TimeStart) / (i * Freq)]); 83 | Application.ProcessMessages; 84 | end; 85 | // Test open/close time 86 | dmMain.ncDBDataset1.Active := False; 87 | dmMain.ncDBDataset1.Active := True; 88 | // Test ExecSQL time 89 | // dmMain.ncDBDataset1.SQL.Text := 'UPDATE Customers SET CustomerName = ''Bill'' where ID = 1'; 90 | // dmMain.ncDBDataset1.ExecSQL; 91 | QueryPerformanceCounter(TimeEnd); 92 | end; 93 | finally 94 | if dmMain.DataSource1.DataSet = nil then 95 | begin 96 | dmMain.DataSource1.DataSet := dmMain.ncDBDataset1; 97 | dmMain.DataSource2.DataSet := dmMain.ncDBDataset2; 98 | end; 99 | end; 100 | finally 101 | InButton1 := False; 102 | end; 103 | end; 104 | 105 | procedure TfrmMain.Button2Click(Sender: TObject); 106 | begin 107 | dmMain.ncDBDataset2.Requery; 108 | end; 109 | 110 | procedure TfrmMain.Button4Click(Sender: TObject); 111 | begin 112 | dmMain.ncDBDataset1.FilterGroup := fgPendingRecords; 113 | dmMain.ncDBDataset1.Filtered := not dmMain.ncDBDataset1.Filtered; 114 | end; 115 | 116 | procedure TfrmMain.btnApplyUpdatesClick(Sender: TObject); 117 | begin 118 | dmMain.ncDBDataset1.ApplyUpdates; 119 | dmMain.ncDBDataset2.ApplyUpdates; 120 | end; 121 | 122 | procedure TfrmMain.edtHostChange(Sender: TObject); 123 | begin 124 | dmMain.ncClientSource.Active := False; 125 | dmMain.ncClientSource.Host := edtHost.Text; 126 | end; 127 | 128 | end. 129 | -------------------------------------------------------------------------------- /Demos/DB/DBServer/Service/DBServerService.dpr: -------------------------------------------------------------------------------- 1 | program DBServerService; 2 | 3 | uses 4 | Windows, 5 | SysUtils, 6 | SvcMgr, 7 | usvcMain in 'usvcMain.pas' {NetcomDataServer: TService}, 8 | uscvServiceCommands in 'uscvServiceCommands.pas'; 9 | 10 | {$R *.RES} 11 | 12 | begin 13 | // Windows 2003 Server requires StartServiceCtrlDispatcher to be 14 | // called before CoRegisterClassObject, which can be called indirectly 15 | // by Application.Initialize. TServiceApplication.DelayInitialize allows 16 | // Application.Initialize to be called from TService.Main (after 17 | // StartServiceCtrlDispatcher has been called). 18 | // 19 | // Delayed initialization of the Application object may affect 20 | // events which then occur prior to initialization, such as 21 | // TService.OnCreate. It is only recommended if the ServiceApplication 22 | // registers a class object with OLE and is intended for use with 23 | // Windows 2003 Server. 24 | // 25 | // Application.DelayInitialize := True; 26 | // 27 | SetCurrentDirectory(PChar (ExtractFilePath (ParamStr (0)))); 28 | if not Application.DelayInitialize or Application.Installing then 29 | Application.Initialize; 30 | Application.CreateForm(TNetcomDataServer, Service); 31 | Application.Run; 32 | end. 33 | -------------------------------------------------------------------------------- /Demos/DB/DBServer/Service/DBServerService.dproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | {1CE60A32-3682-445E-BC9A-10E419519CEC} 4 | 12.0 5 | DBServerService.dpr 6 | Debug 7 | DCC32 8 | 9 | 10 | true 11 | 12 | 13 | true 14 | Base 15 | true 16 | 17 | 18 | true 19 | Base 20 | true 21 | 22 | 23 | DBServerService.exe 24 | $(BDSCOMMONDIR)\DCU 25 | $(BDSCOMMONDIR)\DCP 26 | vcl;rtl;vclx;vclactnband;xmlrtl;vclimg;dbrtl;vcldb;vcldbx;bdertl;vcltouch;dsnap;dsnapcon;TeeUI;TeeDB;Tee;vclib;ibxpress;adortl;IndyCore;IndySystem;IndyProtocols;inet;intrawebdb_100_140;Intraweb_100_140;VclSmp;vclie;websnap;webdsnap;inetdb;inetdbbde;inetdbxpress;soaprtl;vclribbon;dbexpress;DbxCommonDriver;DataSnapIndy10ServerTransport;DataSnapProviderClient;DbxClientDriver;DataSnapServer;DBXInterBaseDriver;DBXMySQLDriver;dbxcds;DBXFirebirdDriver;DBXSybaseASEDriver;DBXSybaseASADriver;DBXOracleDriver;DBXMSSQLDriver;DBXInformixDriver;DBXDb2Driver;dxSkinscxPCPainterD14;cxPageControlD14;dxSkinsCoreD14;dxSkinsdxLCPainterD14;dxLayoutControlD14;dxSkinscxScheduler3PainterD14;cxSchedulerD14;dxSkinsdxNavBar2PainterD14;dxNavBarD14;dxSkinsdxDLPainterD14;dxDockingD14;dxSkinsdxRibbonPainterD14;dxRibbonD14;dxBarD14;dxSkinsdxBarPainterD14;dclOfficeXP 27 | 00400000 28 | x86 29 | WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;$(DCC_UnitAlias) 30 | true 31 | 32 | 33 | false 34 | false 35 | RELEASE;$(DCC_Define) 36 | 0 37 | false 38 | 39 | 40 | true 41 | DEBUG;$(DCC_Define) 42 | 43 | 44 | 45 | MainSource 46 | 47 | 48 |
NetcomDataServer
49 | TService 50 |
51 | 52 | 53 | Base 54 | 55 | 56 | Cfg_2 57 | Base 58 | 59 | 60 | Cfg_1 61 | Base 62 | 63 |
64 | 65 | 66 | Delphi.Personality.12 67 | 68 | 69 | 70 | 71 | DBServerService.dpr 72 | 73 | 74 | False 75 | True 76 | False 77 | /install 78 | 79 | 80 | True 81 | False 82 | 1 83 | 0 84 | 0 85 | 0 86 | False 87 | False 88 | False 89 | False 90 | True 91 | 1033 92 | 1200 93 | 94 | 95 | 96 | Service Prototype 97 | 1.0.0.0 98 | 99 | 100 | 101 | 102 | 103 | 1.0.0.0 104 | 105 | 106 | Embarcadero C++Builder Office XP Servers Package 107 | Embarcadero C++Builder Office 2000 Servers Package 108 | Microsoft Office 2000 Sample Automation Server Wrapper Components 109 | ExpressPivotGrid 2 OLAP by Developer Express Inc. 110 | 111 | 112 | 113 | 12 114 | 115 |
116 | -------------------------------------------------------------------------------- /Demos/DB/DBServer/Service/DBServerService.dproj.local: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /Demos/DB/DBServer/Service/DBServerService.identcache: -------------------------------------------------------------------------------- 1 | nC:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\DB\DBServer\Service\uscvServiceCommands.pascC:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\DB\DBServer\Service\usvcMain.pasjC:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\DB\DBServer\Service\DBServerService.dpr -------------------------------------------------------------------------------- /Demos/DB/DBServer/Service/DBServerService.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/Demos/DB/DBServer/Service/DBServerService.res -------------------------------------------------------------------------------- /Demos/DB/DBServer/Service/DBServerService.skincfg: -------------------------------------------------------------------------------- 1 | [ExpressSkins] 2 | Default=1 3 | ShowNotifications=1 4 | Enabled=1 5 | dxSkinBlack=0 6 | dxSkinBlue=0 7 | dxSkinCaramel=0 8 | dxSkinCoffee=0 9 | dxSkinDarkRoom=0 10 | dxSkinDarkSide=0 11 | dxSkinFoggy=0 12 | dxSkinGlassOceans=0 13 | dxSkiniMaginary=0 14 | dxSkinLilian=0 15 | dxSkinLiquidSky=0 16 | dxSkinLondonLiquidSky=0 17 | dxSkinMcSkin=0 18 | dxSkinMoneyTwins=0 19 | dxSkinOffice2007Black=0 20 | dxSkinOffice2007Blue=0 21 | dxSkinOffice2007Green=0 22 | dxSkinOffice2007Pink=0 23 | dxSkinOffice2007Silver=0 24 | dxSkinPumpkin=0 25 | dxSkinSeven=0 26 | dxSkinSharp=0 27 | dxSkinSilver=0 28 | dxSkinSpringTime=0 29 | dxSkinStardust=0 30 | dxSkinSummer2008=0 31 | dxSkinsDefaultPainters=0 32 | dxSkinValentine=0 33 | dxSkinXmas2008Blue=0 34 | -------------------------------------------------------------------------------- /Demos/DB/DBServer/Service/DBServerService_Icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/Demos/DB/DBServer/Service/DBServerService_Icon.ico -------------------------------------------------------------------------------- /Demos/DB/DBServer/Service/uscvServiceCommands.pas: -------------------------------------------------------------------------------- 1 | unit uscvServiceCommands; 2 | 3 | interface 4 | 5 | implementation 6 | 7 | end. 8 | -------------------------------------------------------------------------------- /Demos/DB/DBServer/Service/usvcMain.dfm: -------------------------------------------------------------------------------- 1 | object NetcomDataServer: TNetcomDataServer 2 | OldCreateOrder = False 3 | OnCreate = ServiceCreate 4 | OnDestroy = ServiceDestroy 5 | DisplayName = 'Netcom7 Database Server' 6 | OnShutdown = ServiceShutdown 7 | OnStart = ServiceStart 8 | OnStop = ServiceStop 9 | Height = 254 10 | Width = 270 11 | object srvController: TncServerSource 12 | Port = 18753 13 | EncryptionKey = 'SetEncryptionKey' 14 | Left = 40 15 | Top = 32 16 | end 17 | object DBServer: TncDBServer 18 | ADOConnection = ADOConnection 19 | Source = srvController 20 | Left = 40 21 | Top = 92 22 | end 23 | object ADOConnection: TADOConnection 24 | ConnectionString = 25 | 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=.\..\TestData\Custo' + 26 | 'mers.mdb;Persist Security Info=False;' 27 | LoginPrompt = False 28 | Mode = cmShareDenyNone 29 | Provider = 'Microsoft.Jet.OLEDB.4.0' 30 | Left = 128 31 | Top = 92 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /Demos/DB/DBServer/Service/usvcMain.pas: -------------------------------------------------------------------------------- 1 | unit usvcMain; 2 | 3 | interface 4 | 5 | uses 6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, SvcMgr, Dialogs, 7 | ncSources, ncSockets, Registry, DB, ADODB, ncCommandHandlers, ncDBSrv, ActiveX; 8 | 9 | type 10 | TsvcOnLogMessage = procedure(Sender: TObject; aMessage: string; aError: Boolean = False) of object; 11 | 12 | // Name property is the name we are going to use to uniquelly identify our service 13 | TNetcomDataServer = class(TService) 14 | srvController: TncServerSource; 15 | DBServer: TncDBServer; 16 | ADOConnection: TADOConnection; 17 | procedure ServiceCreate(Sender: TObject); 18 | procedure ServiceDestroy(Sender: TObject); 19 | procedure ServiceStart(Sender: TService; var Started: Boolean); 20 | procedure ServiceStop(Sender: TService; var Stopped: Boolean); 21 | procedure ServiceShutdown(Sender: TService); 22 | private 23 | FOnLogMessage: TsvcOnLogMessage; 24 | function GetServicePort: Integer; 25 | procedure SetServicePort(const Value: Integer); 26 | function GetDBConnectionString: string; 27 | procedure SetDBConnectionString(const Value: string); 28 | procedure StopAndShutdown; 29 | function GetCacheResponses: Boolean; 30 | procedure SetCacheResponses(const Value: Boolean); 31 | public 32 | Settings: TRegistry; 33 | procedure Log(aStr: string; aError: Boolean = False); 34 | function GetServiceController: TServiceController; override; 35 | property OnLogMessage: TsvcOnLogMessage read FOnLogMessage write FOnLogMessage; 36 | property ServicePort: Integer read GetServicePort write SetServicePort; 37 | property DBConnectionString: string read GetDBConnectionString write SetDBConnectionString; 38 | property CacheResponses: Boolean read GetCacheResponses write SetCacheResponses; 39 | end; 40 | 41 | var 42 | Service: TNetcomDataServer; 43 | 44 | implementation 45 | 46 | uses uscvServiceCommands; 47 | {$R *.DFM} 48 | 49 | procedure ServiceController(CtrlCode: DWord); stdcall; 50 | begin 51 | Service.Controller(CtrlCode); 52 | end; 53 | 54 | function TNetcomDataServer.GetServiceController: TServiceController; 55 | begin 56 | Result := ServiceController; 57 | end; 58 | 59 | procedure TNetcomDataServer.ServiceCreate(Sender: TObject); 60 | begin 61 | FOnLogMessage := nil; 62 | Settings := TRegistry.Create(KEY_READ or KEY_WRITE); 63 | Settings.LazyWrite := False; 64 | Settings.RootKey := HKEY_CURRENT_USER; 65 | if not Settings.OpenKey('\HKEY_CURRENT_USER\Software\' + Name, True) then 66 | Log('Cannot open settings key: \HKEY_CURRENT_USER\Software\' + Name); 67 | end; 68 | 69 | procedure TNetcomDataServer.ServiceDestroy(Sender: TObject); 70 | begin 71 | Settings.CloseKey; 72 | Settings.Free; 73 | end; 74 | 75 | procedure TNetcomDataServer.Log(aStr: string; aError: Boolean = False); 76 | var 77 | ErrType: DWord; 78 | begin 79 | if Assigned(FOnLogMessage) then 80 | // Call custom handler 81 | FOnLogMessage(Self, aStr, aError) 82 | else 83 | begin 84 | // Write to windows log system 85 | if aError then 86 | ErrType := EVENTLOG_AUDIT_FAILURE 87 | else 88 | ErrType := EVENTLOG_AUDIT_SUCCESS; 89 | Self.LogMessage(aStr, ErrType); 90 | end; 91 | end; 92 | 93 | procedure TNetcomDataServer.ServiceStart(Sender: TService; var Started: Boolean); 94 | begin 95 | try 96 | CoInitialize(nil); 97 | // Put critical startup code here 98 | srvController.Port := ServicePort; 99 | ADOConnection.ConnectionString := DBConnectionString; 100 | DBServer.CacheResponses := CacheResponses; 101 | 102 | ADOConnection.Connected := True; 103 | srvController.Active := True; 104 | 105 | Log('"' + DisplayName + '" (' + Name + ') service started successfully, on port: ' + IntTostr(srvController.Port)); 106 | except 107 | on E: Exception do 108 | begin 109 | Log('"' + DisplayName + '" (' + Name + ') service failed to start. ' + E.Message, True); 110 | Started := False; 111 | end; 112 | end; 113 | end; 114 | 115 | procedure TNetcomDataServer.ServiceStop(Sender: TService; var Stopped: Boolean); 116 | begin 117 | StopAndShutdown; 118 | 119 | Log('"' + DisplayName + '" service stopped successfully'); 120 | end; 121 | 122 | procedure TNetcomDataServer.ServiceShutdown(Sender: TService); 123 | begin 124 | StopAndShutdown; 125 | 126 | Log('"' + DisplayName + '" service stopped successfully'); 127 | end; 128 | 129 | procedure TNetcomDataServer.StopAndShutdown; 130 | begin 131 | srvController.Active := False; 132 | ADOConnection.Connected := False; 133 | CoUninitialize; 134 | end; 135 | 136 | function TNetcomDataServer.GetServicePort: Integer; 137 | begin 138 | try 139 | if not Settings.ValueExists('ServicePort') then 140 | Abort; 141 | Result := Settings.ReadInteger('ServicePort'); 142 | except 143 | Result := srvController.Port; 144 | end; 145 | end; 146 | 147 | procedure TNetcomDataServer.SetServicePort(const Value: Integer); 148 | begin 149 | Settings.WriteInteger('ServicePort', Value); 150 | end; 151 | 152 | function TNetcomDataServer.GetDBConnectionString: string; 153 | begin 154 | try 155 | if not Settings.ValueExists('DBConnection') then 156 | Abort; 157 | Result := Settings.ReadString('DBConnection'); 158 | except 159 | Result := ADOConnection.ConnectionString; 160 | end; 161 | end; 162 | 163 | procedure TNetcomDataServer.SetDBConnectionString(const Value: string); 164 | begin 165 | Settings.WriteString('DBConnection', Value); 166 | end; 167 | 168 | function TNetcomDataServer.GetCacheResponses: Boolean; 169 | begin 170 | try 171 | if not Settings.ValueExists('CacheResponses') then 172 | Abort; 173 | Result := Settings.ReadBool('CacheResponses'); 174 | except 175 | Result := DBServer.CacheResponses; 176 | end; 177 | end; 178 | 179 | procedure TNetcomDataServer.SetCacheResponses(const Value: Boolean); 180 | begin 181 | Settings.WriteBool('CacheResponses', Value); 182 | end; 183 | 184 | end. 185 | -------------------------------------------------------------------------------- /Demos/DB/DBServer/ServiceApplication/DBServerApplication.dpr: -------------------------------------------------------------------------------- 1 | program DBServerApplication; 2 | 3 | uses 4 | Forms, 5 | ufrmMain in 'ufrmMain.pas' { frmMain } , 6 | uscvServiceCommands in '..\Service\uscvServiceCommands.pas', 7 | usvcMain in '..\Service\usvcMain.pas' { svcMain: TService } ; 8 | {$R *.res} 9 | 10 | begin 11 | ReportMemoryLeaksOnShutdown := True; 12 | 13 | Application.Initialize; 14 | Application.MainFormOnTaskbar := True; 15 | Application.ShowMainForm := False; 16 | Service := TNetcomDataServer.Create(nil); 17 | try 18 | Application.Title := Service.DisplayName; 19 | Application.CreateForm(TfrmMain, frmMain); 20 | Application.Run; 21 | finally 22 | Service.Free; 23 | end; 24 | end. 25 | -------------------------------------------------------------------------------- /Demos/DB/DBServer/ServiceApplication/DBServerApplication.dproj.local: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 2011/04/04 13:08:58.034.dfm,C:\Users\BDemos\Documents\RAD Studio\Workspace\TrayLogServiceModule\ServiceConsole\ufrmMain.dfm=C:\Users\BDemos\Documents\RAD Studio\Projects\Unit1.dfm 5 | 2011/04/04 13:08:58.034.pas,C:\Users\BDemos\Documents\RAD Studio\Workspace\TrayLogServiceModule\ServiceConsole\ufrmMain.pas=C:\Users\BDemos\Documents\RAD Studio\Projects\Unit1.pas 6 | 2011/04/04 13:09:06.196.dproj,C:\Users\BDemos\Documents\RAD Studio\Workspace\TrayLogServiceModule\ServiceConsole\ServiceConsole.dproj=C:\Users\BDemos\Documents\RAD Studio\Projects\Project1.dproj 7 | 2011/04/05 09:14:37.644.dproj,C:\Users\BDemos\Documents\RAD Studio\Workspace\TrayLogServiceModule\ServiceConsole\ServiceApplication.dproj=C:\Users\BDemos\Documents\RAD Studio\Workspace\TrayLogServiceModule\ServiceConsole\ServiceConsole.dproj 8 | 2011/04/06 10:27:07.382.dproj,C:\Users\BDemos\Documents\RAD Studio\Components\NetCom7\Demos\DB\DBServer\ServiceApplication\DBServerApplication.dproj=C:\Users\BDemos\Documents\RAD Studio\Components\NetCom7\Demos\DB\DBServer\ServiceApplication\ServiceApplication.dproj 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Demos/DB/DBServer/ServiceApplication/DBServerApplication.identcache: -------------------------------------------------------------------------------- 1 | nC:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\DB\DBServer\ServiceApplication\ufrmMain.pasyC:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\DB\DBServer\ServiceApplication\DBServerApplication.dprnC:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\DB\DBServer\Service\uscvServiceCommands.pascC:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\DB\DBServer\Service\usvcMain.pas -------------------------------------------------------------------------------- /Demos/DB/DBServer/ServiceApplication/DBServerApplication.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/Demos/DB/DBServer/ServiceApplication/DBServerApplication.res -------------------------------------------------------------------------------- /Demos/DB/DBServer/ServiceApplication/DBServerApplication.skincfg: -------------------------------------------------------------------------------- 1 | [ExpressSkins] 2 | Default=1 3 | ShowNotifications=1 4 | Enabled=1 5 | dxSkinBlack=0 6 | dxSkinBlue=0 7 | dxSkinCaramel=0 8 | dxSkinCoffee=0 9 | dxSkinDarkRoom=0 10 | dxSkinDarkSide=0 11 | dxSkinFoggy=0 12 | dxSkinGlassOceans=0 13 | dxSkiniMaginary=0 14 | dxSkinLilian=0 15 | dxSkinLiquidSky=0 16 | dxSkinLondonLiquidSky=0 17 | dxSkinMcSkin=0 18 | dxSkinMoneyTwins=0 19 | dxSkinOffice2007Black=0 20 | dxSkinOffice2007Blue=0 21 | dxSkinOffice2007Green=0 22 | dxSkinOffice2007Pink=0 23 | dxSkinOffice2007Silver=0 24 | dxSkinPumpkin=0 25 | dxSkinSeven=0 26 | dxSkinSharp=0 27 | dxSkinSilver=0 28 | dxSkinSpringTime=0 29 | dxSkinStardust=0 30 | dxSkinSummer2008=0 31 | dxSkinsDefaultPainters=0 32 | dxSkinValentine=0 33 | dxSkinXmas2008Blue=0 34 | -------------------------------------------------------------------------------- /Demos/DB/DBServer/ServiceApplication/DBServerApplication_Icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/Demos/DB/DBServer/ServiceApplication/DBServerApplication_Icon.ico -------------------------------------------------------------------------------- /Demos/DB/DBServer/TestData/Customers.mdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/Demos/DB/DBServer/TestData/Customers.mdb -------------------------------------------------------------------------------- /Demos/NetComVSIndy/Client/NetComVSIndyClient.dpr: -------------------------------------------------------------------------------- 1 | program NetComVSIndyClient; 2 | 3 | uses 4 | Vcl.Forms, 5 | ufrmMain in 'ufrmMain.pas' {frmMain}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.MainFormOnTaskbar := True; 12 | Application.CreateForm(TfrmMain, frmMain); 13 | Application.Run; 14 | end. 15 | -------------------------------------------------------------------------------- /Demos/NetComVSIndy/Client/NetComVSIndyClient.dproj.local: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 2018/09/21 12:49:51.000.179,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 5 | 2018/09/24 13:18:27.000.279,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 6 | 2018/10/10 13:56:06.000.238,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 7 | 2018/10/16 10:56:54.000.938,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 8 | 2018/10/16 11:40:09.000.191,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 9 | 2018/11/04 15:48:45.000.203,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 10 | 2018/11/04 16:17:18.000.148,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 11 | 2018/11/04 16:17:48.000.272,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 12 | 2018/11/23 20:02:18.000.772,=C:\Users\Programmer\Documents\Development\Projects\Unit2.pas 13 | 2019/02/27 18:05:16.000.392,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 14 | 2019/02/27 18:06:31.000.995,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 15 | 2019/02/27 18:12:19.000.197,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 16 | 2019/03/05 12:15:54.000.434,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 17 | 2019/03/05 13:06:38.000.677,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 18 | 2019/03/11 18:09:12.000.176,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 19 | 2019/03/25 16:12:14.000.258,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 20 | 2019/05/29 14:49:59.000.196,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 21 | 2019/05/31 18:08:29.000.138,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 22 | 2019/08/21 21:29:49.000.507,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 23 | 2019/09/18 13:39:12.000.759,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 24 | 2019/11/09 19:07:03.000.902,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 25 | 2019/12/15 14:13:57.000.985,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 26 | 2020/04/13 08:49:52.000.721,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 27 | 2020/04/14 04:39:08.000.542,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 28 | 2020/04/15 03:31:58.000.910,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 29 | 2020/07/02 09:58:25.000.183,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 30 | 2020/07/02 20:01:51.000.926,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 31 | 2020/07/05 15:55:38.000.562,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 32 | 2020/07/08 18:03:33.000.205,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 33 | 2020/07/16 00:09:13.000.392,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 34 | 2020/08/07 10:38:54.000.477,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 35 | 2020/08/08 10:30:32.000.363,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 36 | 2020/08/10 13:26:25.000.247,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 37 | 2020/08/11 06:18:58.000.380,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 38 | 2020/08/11 06:47:57.000.575,C:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\NetComVSIndy\Client\ufrmMain.dfm=C:\Users\Programmer\Documents\Development\Projects\Unit3.dfm 39 | 2020/08/11 06:47:57.000.575,C:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\NetComVSIndy\Client\ufrmMain.pas=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 40 | 2020/08/11 06:48:06.000.793,C:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\NetComVSIndy\Client\NetComVSIndyClient.dproj=C:\Users\Programmer\Documents\Development\Projects\Project1.dproj 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Demos/NetComVSIndy/Client/NetComVSIndyClient.identcache: -------------------------------------------------------------------------------- 1 | mC:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\NetComVSIndy\Client\NetComVSIndyClient.dprcC:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\NetComVSIndy\Client\ufrmMain.pas -------------------------------------------------------------------------------- /Demos/NetComVSIndy/Client/NetComVSIndyClient.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/Demos/NetComVSIndy/Client/NetComVSIndyClient.res -------------------------------------------------------------------------------- /Demos/NetComVSIndy/Client/ufrmMain.dfm: -------------------------------------------------------------------------------- 1 | object frmMain: TfrmMain 2 | Left = 0 3 | Top = 0 4 | Caption = 'NetCom vs Indy speed testing' 5 | ClientHeight = 358 6 | ClientWidth = 802 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | OnCreate = FormCreate 15 | PixelsPerInch = 96 16 | TextHeight = 13 17 | object pnlToolbar: TPanel 18 | Left = 0 19 | Top = 0 20 | Width = 802 21 | Height = 41 22 | Align = alTop 23 | BevelOuter = bvNone 24 | FullRepaint = False 25 | TabOrder = 0 26 | object Label1: TLabel 27 | Left = 328 28 | Top = 14 29 | Width = 51 30 | Height = 13 31 | Caption = 'Iterations:' 32 | end 33 | object btnTestSpeed: TButton 34 | Left = 0 35 | Top = 0 36 | Width = 121 37 | Height = 41 38 | Align = alLeft 39 | Caption = 'Test Speed' 40 | TabOrder = 0 41 | OnClick = btnTestSpeedClick 42 | end 43 | object edtIterations: TSpinEdit 44 | Left = 385 45 | Top = 11 46 | Width = 81 47 | Height = 22 48 | MaxValue = 0 49 | MinValue = 0 50 | TabOrder = 1 51 | Value = 10000 52 | end 53 | object rbTestNetCom: TRadioButton 54 | Left = 145 55 | Top = 12 56 | Width = 80 57 | Height = 17 58 | Caption = 'Test NetCom' 59 | Checked = True 60 | TabOrder = 2 61 | TabStop = True 62 | end 63 | object rbTestIndy: TRadioButton 64 | Left = 231 65 | Top = 12 66 | Width = 82 67 | Height = 17 68 | Caption = 'Test Indy' 69 | TabOrder = 3 70 | end 71 | end 72 | object memLog: TMemo 73 | Left = 0 74 | Top = 41 75 | Width = 802 76 | Height = 317 77 | Align = alClient 78 | TabOrder = 1 79 | end 80 | object ncClient: TncTCPClient 81 | Host = 'LocalHost' 82 | UseReaderThread = False 83 | NoDelay = True 84 | KeepAlive = False 85 | Reconnect = False 86 | Left = 304 87 | Top = 32 88 | end 89 | object idClient: TIdTCPClient 90 | ConnectTimeout = 0 91 | Host = 'LocalHost' 92 | IPVersion = Id_IPv4 93 | Port = 16234 94 | ReadTimeout = -1 95 | Left = 304 96 | Top = 88 97 | end 98 | end 99 | -------------------------------------------------------------------------------- /Demos/NetComVSIndy/Client/ufrmMain.pas: -------------------------------------------------------------------------------- 1 | unit ufrmMain; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 7 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, Vcl.Samples.Spin, 8 | IdTCPConnection, IdTCPClient, IdBaseComponent, IdComponent, IdCustomTCPServer, 9 | IdTCPServer, IdContext, IdGlobal, 10 | Winapi.Winsock2, System.Diagnostics, ncSockets, ncLines; 11 | 12 | const 13 | // We are testing the socket mechanisms here and not how fast tcp/ip is, 14 | // therefore the buffer sent back and forth is kept at a fairly minimal size 15 | BuffSize = 256; 16 | 17 | type 18 | TfrmMain = class(TForm) 19 | ncClient: TncTCPClient; 20 | idClient: TIdTCPClient; 21 | pnlToolbar: TPanel; 22 | memLog: TMemo; 23 | btnTestSpeed: TButton; 24 | edtIterations: TSpinEdit; 25 | Label1: TLabel; 26 | rbTestNetCom: TRadioButton; 27 | rbTestIndy: TRadioButton; 28 | procedure FormCreate(Sender: TObject); 29 | procedure btnTestSpeedClick(Sender: TObject); 30 | private 31 | BufferSend, BufferRead: TBytes; 32 | idBufferSend, idBufferRead: TidBytes; 33 | public 34 | end; 35 | 36 | var 37 | frmMain: TfrmMain; 38 | 39 | implementation 40 | 41 | {$R *.dfm} 42 | 43 | procedure TfrmMain.FormCreate(Sender: TObject); 44 | begin 45 | SetLength(BufferSend, BuffSize); 46 | SetLength(BufferRead, BuffSize); 47 | SetLength(idBufferSend, BuffSize); 48 | SetLength(idBufferRead, BuffSize); 49 | end; 50 | 51 | procedure TfrmMain.btnTestSpeedClick(Sender: TObject); 52 | var 53 | i: Integer; 54 | TimeSt: Cardinal; 55 | TimeTaken: Cardinal; 56 | begin 57 | if rbTestNetCom.Checked then 58 | ncClient.Active := True; 59 | if rbTestIndy.Checked then 60 | idClient.Connect; 61 | 62 | if rbTestNetCom.Checked then 63 | begin 64 | memLog.Lines.Add('Testing NetCom...'); 65 | TimeSt := GetTickCount; 66 | for i := 1 to edtIterations.Value do 67 | begin 68 | ncClient.Send(BufferSend); 69 | ncClient.ReceiveRaw(BufferRead); 70 | end; 71 | TimeTaken := GetTickCount - TimeSt; 72 | memLog.Lines.Add('Time taken: ' + IntToStr(TimeTaken) + ' msec'); 73 | end; 74 | 75 | if rbTestIndy.Checked then 76 | begin 77 | memLog.Lines.Add('Testing Indy...'); 78 | TimeSt := GetTickCount; 79 | for i := 1 to edtIterations.Value do 80 | begin 81 | idClient.Socket.Write(idBufferSend); 82 | idClient.Socket.ReadBytes(idBufferRead, BuffSize, False); 83 | end; 84 | TimeTaken := GetTickCount - TimeSt; 85 | memLog.Lines.Add('Time taken: ' + IntToStr(TimeTaken) + ' msec'); 86 | end; 87 | 88 | if rbTestNetCom.Checked then 89 | ncClient.Active := False; 90 | if rbTestIndy.Checked then 91 | idClient.Disconnect; 92 | end; 93 | 94 | end. 95 | -------------------------------------------------------------------------------- /Demos/NetComVSIndy/Server/NetComVSIndyServer.dpr: -------------------------------------------------------------------------------- 1 | program NetComVSIndyServer; 2 | 3 | uses 4 | Vcl.Forms, 5 | ufrmMain in 'ufrmMain.pas' {frmMain}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.MainFormOnTaskbar := True; 12 | Application.CreateForm(TfrmMain, frmMain); 13 | Application.Run; 14 | end. 15 | -------------------------------------------------------------------------------- /Demos/NetComVSIndy/Server/NetComVSIndyServer.dproj.local: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 2018/09/21 12:49:51.000.179,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 5 | 2018/09/24 13:18:27.000.279,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 6 | 2018/10/10 13:56:06.000.238,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 7 | 2018/10/16 10:56:54.000.938,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 8 | 2018/10/16 11:40:09.000.191,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 9 | 2018/11/04 15:48:45.000.203,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 10 | 2018/11/04 16:17:18.000.148,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 11 | 2018/11/04 16:17:48.000.272,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 12 | 2018/11/23 20:02:18.000.772,=C:\Users\Programmer\Documents\Development\Projects\Unit2.pas 13 | 2019/02/27 18:05:16.000.392,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 14 | 2019/02/27 18:06:31.000.995,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 15 | 2019/02/27 18:12:19.000.197,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 16 | 2019/03/05 12:15:54.000.434,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 17 | 2019/03/05 13:06:38.000.677,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 18 | 2019/03/11 18:09:12.000.176,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 19 | 2019/03/25 16:12:14.000.258,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 20 | 2019/05/29 14:49:59.000.196,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 21 | 2019/05/31 18:08:29.000.138,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 22 | 2019/08/21 21:29:49.000.507,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 23 | 2019/09/18 13:39:12.000.759,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 24 | 2019/11/09 19:07:03.000.902,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 25 | 2019/12/15 14:13:57.000.985,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 26 | 2020/04/13 08:49:52.000.721,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 27 | 2020/04/14 04:39:08.000.542,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 28 | 2020/04/15 03:31:58.000.910,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 29 | 2020/07/02 09:58:25.000.183,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 30 | 2020/07/02 20:01:51.000.926,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 31 | 2020/07/05 15:55:38.000.562,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 32 | 2020/07/08 18:03:33.000.205,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 33 | 2020/07/16 00:09:13.000.392,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 34 | 2020/08/07 10:38:54.000.477,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 35 | 2020/08/08 10:30:32.000.363,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 36 | 2020/08/10 13:26:25.000.247,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 37 | 2020/08/11 06:48:47.000.137,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 38 | 2020/08/11 06:50:30.000.325,C:\Users\Programmer\Documents\Development\Projects\Unit3.dfm=C:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\NetComVSIndy\Server\ufrmMain.dfm 39 | 2020/08/11 06:50:30.000.325,C:\Users\Programmer\Documents\Development\Projects\Unit3.pas=C:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\NetComVSIndy\Server\ufrmMain.pas 40 | 2020/08/11 06:50:45.000.950,C:\Users\Programmer\Documents\Development\Projects\Project1.dproj=C:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\NetComVSIndy\Server\NetComVSIndyServer.dproj 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Demos/NetComVSIndy/Server/NetComVSIndyServer.identcache: -------------------------------------------------------------------------------- 1 | cC:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\NetComVSIndy\Server\ufrmMain.pasmC:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\NetComVSIndy\Server\NetComVSIndyServer.dpr -------------------------------------------------------------------------------- /Demos/NetComVSIndy/Server/NetComVSIndyServer.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/Demos/NetComVSIndy/Server/NetComVSIndyServer.res -------------------------------------------------------------------------------- /Demos/NetComVSIndy/Server/ufrmMain.dfm: -------------------------------------------------------------------------------- 1 | object frmMain: TfrmMain 2 | Left = 0 3 | Top = 0 4 | Caption = 'NetCom VS Indy Server' 5 | ClientHeight = 57 6 | ClientWidth = 601 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | OnCreate = FormCreate 15 | PixelsPerInch = 96 16 | TextHeight = 13 17 | object Label1: TLabel 18 | Left = 24 19 | Top = 24 20 | Width = 555 21 | Height = 13 22 | Caption = 23 | 'Servers activate on creation (except if there was an error). You' + 24 | ' can now run the client while this program is running' 25 | end 26 | object ncServer: TncTCPServer 27 | NoDelay = True 28 | OnReadData = ncServerReadData 29 | Left = 456 30 | Top = 8 31 | end 32 | object idServer: TIdTCPServer 33 | Bindings = <> 34 | DefaultPort = 16234 35 | OnExecute = idServerExecute 36 | Left = 504 37 | Top = 8 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /Demos/NetComVSIndy/Server/ufrmMain.pas: -------------------------------------------------------------------------------- 1 | unit ufrmMain; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 7 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Winapi.Winsock2, 8 | IdContext, IdBaseComponent, IdComponent, IdCustomTCPServer, IdTCPServer, IdGlobal, 9 | System.Diagnostics, ncLines, ncSockets, Vcl.StdCtrls; 10 | 11 | type 12 | TfrmMain = class(TForm) 13 | ncServer: TncTCPServer; 14 | idServer: TIdTCPServer; 15 | Label1: TLabel; 16 | procedure FormCreate(Sender: TObject); 17 | procedure ncServerReadData(Sender: TObject; aLine: TncLine; 18 | const aBuf: TArray; aBufCount: Integer); 19 | procedure idServerExecute(AContext: TIdContext); 20 | private 21 | { Private declarations } 22 | public 23 | { Public declarations } 24 | end; 25 | 26 | var 27 | frmMain: TfrmMain; 28 | 29 | implementation 30 | 31 | {$R *.dfm} 32 | 33 | procedure TfrmMain.FormCreate(Sender: TObject); 34 | begin 35 | ncServer.Active := True; 36 | idServer.Active := True; 37 | end; 38 | 39 | procedure TfrmMain.idServerExecute(AContext: TIdContext); 40 | var 41 | Data: TIdBytes; 42 | begin 43 | // Reply with data received 44 | if not aContext.Connection.IOHandler.InputBufferIsEmpty then 45 | begin 46 | aContext.Connection.IOHandler.InputBuffer.ExtractToBytes(Data); 47 | aContext.Binding.Send(Data); 48 | end; 49 | end; 50 | 51 | procedure TfrmMain.ncServerReadData(Sender: TObject; aLine: TncLine; 52 | const aBuf: TArray; aBufCount: Integer); 53 | var 54 | Data: TBytes; 55 | begin 56 | // Reply with data received 57 | Data := Copy (aBuf, 0, aBufCount); 58 | ncServer.Send(aLine, Data); 59 | end; 60 | 61 | end. 62 | -------------------------------------------------------------------------------- /Demos/SimpleSockets/Client/Client.dpr: -------------------------------------------------------------------------------- 1 | program Client; 2 | 3 | uses 4 | Vcl.Forms, 5 | ufrmMain in 'ufrmMain.pas' {Form1}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | {$IFDEF DEBUG} 11 | ReportMemoryLeaksOnShutdown := True; 12 | {$ENDIF} 13 | Application.Initialize; 14 | Application.MainFormOnTaskbar := True; 15 | Application.CreateForm(TForm1, Form1); 16 | Application.Run; 17 | end. 18 | -------------------------------------------------------------------------------- /Demos/SimpleSockets/Client/Client.dproj.local: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Demos/SimpleSockets/Client/Client.identcache: -------------------------------------------------------------------------------- 1 | CD:\_Delphi\_Library\Netcom7\Demos\SimpleSockets\Client\ufrmMain.pasAD:\_Delphi\_Library\Netcom7\Demos\SimpleSockets\Client\Client.dpr -------------------------------------------------------------------------------- /Demos/SimpleSockets/Client/Client.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/Demos/SimpleSockets/Client/Client.res -------------------------------------------------------------------------------- /Demos/SimpleSockets/Client/Client.skincfg: -------------------------------------------------------------------------------- 1 | [ExpressSkins] 2 | Default=1 3 | ShowNotifications=1 4 | Enabled=1 5 | dxSkinBlack=1 6 | dxSkinBlue=0 7 | dxSkinCaramel=0 8 | dxSkinCoffee=0 9 | dxSkinDarkRoom=0 10 | dxSkinDarkSide=1 11 | dxSkinFoggy=0 12 | dxSkinGlassOceans=0 13 | dxSkiniMaginary=0 14 | dxSkinLilian=0 15 | dxSkinLiquidSky=0 16 | dxSkinLondonLiquidSky=0 17 | dxSkinMcSkin=0 18 | dxSkinMoneyTwins=0 19 | dxSkinOffice2007Black=1 20 | dxSkinOffice2007Blue=0 21 | dxSkinOffice2007Green=0 22 | dxSkinOffice2007Pink=0 23 | dxSkinOffice2007Silver=1 24 | dxSkinPumpkin=0 25 | dxSkinSeven=0 26 | dxSkinSharp=0 27 | dxSkinSilver=0 28 | dxSkinSpringTime=0 29 | dxSkinStardust=0 30 | dxSkinSummer2008=0 31 | dxSkinsDefaultPainters=0 32 | dxSkinValentine=0 33 | dxSkinXmas2008Blue=0 34 | -------------------------------------------------------------------------------- /Demos/SimpleSockets/Client/Client_Icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/Demos/SimpleSockets/Client/Client_Icon.ico -------------------------------------------------------------------------------- /Demos/SimpleSockets/Client/ufrmMain.dfm: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | ActiveControl = edtDataToSend 5 | Caption = 'TCPClient' 6 | ClientHeight = 243 7 | ClientWidth = 527 8 | Color = clBtnFace 9 | Font.Charset = DEFAULT_CHARSET 10 | Font.Color = clWindowText 11 | Font.Height = -11 12 | Font.Name = 'Tahoma' 13 | Font.Style = [] 14 | Position = poScreenCenter 15 | OnCreate = FormCreate 16 | OnDestroy = FormDestroy 17 | TextHeight = 13 18 | object memLog: TMemo 19 | AlignWithMargins = True 20 | Left = 5 21 | Top = 37 22 | Width = 517 23 | Height = 169 24 | Margins.Left = 5 25 | Margins.Top = 0 26 | Margins.Right = 5 27 | Margins.Bottom = 5 28 | Align = alClient 29 | ReadOnly = True 30 | ScrollBars = ssVertical 31 | TabOrder = 1 32 | OnKeyDown = memLogKeyDown 33 | end 34 | object pnlToolbar: TPanel 35 | Left = 0 36 | Top = 0 37 | Width = 527 38 | Height = 37 39 | Align = alTop 40 | BevelOuter = bvNone 41 | FullRepaint = False 42 | TabOrder = 0 43 | object btnActivate: TButton 44 | AlignWithMargins = True 45 | Left = 5 46 | Top = 5 47 | Width = 105 48 | Height = 27 49 | Margins.Left = 5 50 | Margins.Top = 5 51 | Margins.Right = 0 52 | Margins.Bottom = 5 53 | Align = alLeft 54 | Caption = 'Start TCP Client' 55 | TabOrder = 0 56 | OnClick = btnActivateClick 57 | end 58 | object pnlAddress: TPanel 59 | AlignWithMargins = True 60 | Left = 110 61 | Top = 3 62 | Width = 417 63 | Height = 31 64 | Margins.Left = 0 65 | Margins.Right = 0 66 | Align = alClient 67 | BevelOuter = bvNone 68 | FullRepaint = False 69 | TabOrder = 1 70 | object edtHost: TEdit 71 | AlignWithMargins = True 72 | Left = 5 73 | Top = 5 74 | Width = 281 75 | Height = 21 76 | Margins.Left = 5 77 | Margins.Top = 5 78 | Margins.Right = 5 79 | Margins.Bottom = 5 80 | Align = alClient 81 | TabOrder = 0 82 | TextHint = 'Enter host address' 83 | OnChange = edtHostChange 84 | end 85 | object edtPort: TSpinEdit 86 | AlignWithMargins = True 87 | Left = 291 88 | Top = 5 89 | Width = 121 90 | Height = 22 91 | Margins.Left = 0 92 | Margins.Top = 5 93 | Margins.Right = 5 94 | Margins.Bottom = 5 95 | Align = alRight 96 | MaxValue = 0 97 | MinValue = 0 98 | TabOrder = 1 99 | Value = 16233 100 | OnChange = edtPortChange 101 | end 102 | end 103 | end 104 | object Panel1: TPanel 105 | Left = 0 106 | Top = 211 107 | Width = 527 108 | Height = 32 109 | Margins.Left = 5 110 | Margins.Top = 0 111 | Margins.Right = 5 112 | Margins.Bottom = 5 113 | Align = alBottom 114 | BevelOuter = bvNone 115 | FullRepaint = False 116 | TabOrder = 2 117 | object btnSendData: TButton 118 | AlignWithMargins = True 119 | Left = 5 120 | Top = 0 121 | Width = 105 122 | Height = 27 123 | Margins.Left = 5 124 | Margins.Top = 0 125 | Margins.Right = 0 126 | Margins.Bottom = 5 127 | Align = alLeft 128 | Caption = 'Send' 129 | Default = True 130 | TabOrder = 0 131 | OnClick = btnSendDataClick 132 | end 133 | object Panel2: TPanel 134 | AlignWithMargins = True 135 | Left = 110 136 | Top = 3 137 | Width = 417 138 | Height = 26 139 | Margins.Left = 0 140 | Margins.Right = 0 141 | Align = alClient 142 | BevelOuter = bvNone 143 | FullRepaint = False 144 | TabOrder = 1 145 | object edtDataToSend: TEdit 146 | AlignWithMargins = True 147 | Left = 5 148 | Top = 0 149 | Width = 407 150 | Height = 21 151 | Margins.Left = 5 152 | Margins.Top = 0 153 | Margins.Right = 5 154 | Margins.Bottom = 5 155 | Align = alClient 156 | TabOrder = 0 157 | Text = 'This is some text data' 158 | TextHint = 'Enter data to send here' 159 | OnEnter = edtDataToSendEnter 160 | OnExit = edtDataToSendExit 161 | end 162 | end 163 | end 164 | object TCPClient: TncTCPClient 165 | OnConnected = TCPClientConnected 166 | OnDisconnected = TCPClientDisconnected 167 | OnReadData = TCPClientReadData 168 | OnReconnected = TCPClientReconnected 169 | Left = 208 170 | Top = 80 171 | end 172 | end 173 | -------------------------------------------------------------------------------- /Demos/SimpleSockets/Server/Server.dpr: -------------------------------------------------------------------------------- 1 | program Server; 2 | 3 | uses 4 | Vcl.Forms, 5 | ufrmMain in 'ufrmMain.pas' {Form1}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | {$IFDEF DEBUG} 11 | ReportMemoryLeaksOnShutdown := True; 12 | {$ENDIF} 13 | Application.Initialize; 14 | Application.MainFormOnTaskbar := True; 15 | Application.CreateForm(TForm1, Form1); 16 | Application.Run; 17 | end. 18 | -------------------------------------------------------------------------------- /Demos/SimpleSockets/Server/Server.dproj.local: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Demos/SimpleSockets/Server/Server.identcache: -------------------------------------------------------------------------------- 1 | CD:\_Delphi\_Library\Netcom7\Demos\SimpleSockets\Server\ufrmMain.pasAD:\_Delphi\_Library\Netcom7\Demos\SimpleSockets\Server\Server.dpr -------------------------------------------------------------------------------- /Demos/SimpleSockets/Server/Server.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/Demos/SimpleSockets/Server/Server.res -------------------------------------------------------------------------------- /Demos/SimpleSockets/Server/Server.skincfg: -------------------------------------------------------------------------------- 1 | [ExpressSkins] 2 | Default=1 3 | ShowNotifications=1 4 | Enabled=1 5 | dxSkinBlack=1 6 | dxSkinBlue=0 7 | dxSkinCaramel=0 8 | dxSkinCoffee=0 9 | dxSkinDarkRoom=0 10 | dxSkinDarkSide=1 11 | dxSkinFoggy=0 12 | dxSkinGlassOceans=0 13 | dxSkiniMaginary=0 14 | dxSkinLilian=0 15 | dxSkinLiquidSky=0 16 | dxSkinLondonLiquidSky=0 17 | dxSkinMcSkin=0 18 | dxSkinMoneyTwins=0 19 | dxSkinOffice2007Black=1 20 | dxSkinOffice2007Blue=0 21 | dxSkinOffice2007Green=0 22 | dxSkinOffice2007Pink=0 23 | dxSkinOffice2007Silver=1 24 | dxSkinPumpkin=0 25 | dxSkinSeven=0 26 | dxSkinSharp=0 27 | dxSkinSilver=0 28 | dxSkinSpringTime=0 29 | dxSkinStardust=0 30 | dxSkinSummer2008=0 31 | dxSkinsDefaultPainters=0 32 | dxSkinValentine=0 33 | dxSkinXmas2008Blue=0 34 | -------------------------------------------------------------------------------- /Demos/SimpleSockets/Server/Server_Icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/Demos/SimpleSockets/Server/Server_Icon.ico -------------------------------------------------------------------------------- /Demos/SimpleSockets/Server/ufrmMain.dfm: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'TCPServer' 5 | ClientHeight = 243 6 | ClientWidth = 527 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | Position = poScreenCenter 14 | OnCreate = FormCreate 15 | OnDestroy = FormDestroy 16 | TextHeight = 13 17 | object memLog: TMemo 18 | AlignWithMargins = True 19 | Left = 5 20 | Top = 37 21 | Width = 517 22 | Height = 201 23 | Margins.Left = 5 24 | Margins.Top = 0 25 | Margins.Right = 5 26 | Margins.Bottom = 5 27 | Align = alClient 28 | ReadOnly = True 29 | ScrollBars = ssVertical 30 | TabOrder = 0 31 | OnKeyDown = memLogKeyDown 32 | end 33 | object pnlToolbar: TPanel 34 | Left = 0 35 | Top = 0 36 | Width = 527 37 | Height = 37 38 | Align = alTop 39 | BevelOuter = bvNone 40 | FullRepaint = False 41 | TabOrder = 1 42 | object btnActivate: TButton 43 | AlignWithMargins = True 44 | Left = 5 45 | Top = 5 46 | Width = 105 47 | Height = 27 48 | Margins.Left = 5 49 | Margins.Top = 5 50 | Margins.Right = 5 51 | Margins.Bottom = 5 52 | Align = alLeft 53 | Caption = 'Activate' 54 | TabOrder = 0 55 | OnClick = btnActivateClick 56 | end 57 | object pblPort: TPanel 58 | AlignWithMargins = True 59 | Left = 115 60 | Top = 3 61 | Width = 412 62 | Height = 31 63 | Margins.Left = 0 64 | Margins.Right = 0 65 | Align = alClient 66 | BevelOuter = bvNone 67 | FullRepaint = False 68 | TabOrder = 1 69 | object edtPort: TSpinEdit 70 | AlignWithMargins = True 71 | Left = 0 72 | Top = 5 73 | Width = 121 74 | Height = 22 75 | Margins.Left = 0 76 | Margins.Top = 5 77 | Margins.Right = 5 78 | Margins.Bottom = 5 79 | Align = alLeft 80 | MaxValue = 0 81 | MinValue = 0 82 | TabOrder = 0 83 | Value = 16233 84 | OnChange = edtPortChange 85 | end 86 | object btnShutdownAllClients: TButton 87 | AlignWithMargins = True 88 | Left = 256 89 | Top = 5 90 | Width = 151 91 | Height = 21 92 | Margins.Left = 5 93 | Margins.Top = 5 94 | Margins.Right = 5 95 | Margins.Bottom = 5 96 | Align = alRight 97 | Caption = 'Shutdown all clients' 98 | TabOrder = 1 99 | OnClick = btnShutdownAllClientsClick 100 | end 101 | end 102 | end 103 | object TCPServer: TncTCPServer 104 | OnConnected = TCPServerConnected 105 | OnDisconnected = TCPServerDisconnected 106 | OnReadData = TCPServerReadData 107 | Left = 92 108 | Top = 52 109 | end 110 | end 111 | -------------------------------------------------------------------------------- /Demos/SimpleSockets/Server/ufrmMain.pas: -------------------------------------------------------------------------------- 1 | unit ufrmMain; 2 | 3 | interface 4 | 5 | uses 6 | {$IFDEF MSWINDOWS} 7 | WinApi.Windows, WinApi.Winsock2, 8 | {$ELSE} 9 | Posix.SysSocket, Posix.Unistd, 10 | {$ENDIF} 11 | System.Classes, System.SysUtils, Vcl.Forms, Vcl.Controls, Vcl.StdCtrls, 12 | Vcl.ExtCtrls, Vcl.Samples.Spin, 13 | System.Diagnostics, ncLines, ncSocketList, ncSockets; 14 | 15 | type 16 | TForm1 = class(TForm) 17 | memLog: TMemo; 18 | TCPServer: TncTCPServer; 19 | pnlToolbar: TPanel; 20 | btnActivate: TButton; 21 | pblPort: TPanel; 22 | edtPort: TSpinEdit; 23 | btnShutdownAllClients: TButton; 24 | procedure FormCreate(Sender: TObject); 25 | procedure FormDestroy(Sender: TObject); 26 | procedure TCPServerConnected(Sender: TObject; aLine: TncLine); 27 | procedure TCPServerDisconnected(Sender: TObject; aLine: TncLine); 28 | procedure btnActivateClick(Sender: TObject); 29 | procedure edtPortChange(Sender: TObject); 30 | procedure btnShutdownAllClientsClick(Sender: TObject); 31 | procedure TCPServerReadData(Sender: TObject; aLine: TncLine; 32 | const aBuf: TBytes; aBufCount: Integer); 33 | procedure Log(const AMessage: string); 34 | procedure memLogKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); 35 | private 36 | public 37 | end; 38 | 39 | var 40 | Form1: TForm1; 41 | 42 | implementation 43 | 44 | {$R *.dfm} 45 | 46 | procedure TForm1.FormCreate(Sender: TObject); 47 | begin 48 | // 49 | end; 50 | 51 | procedure TForm1.FormDestroy(Sender: TObject); 52 | begin 53 | TCPServer.Active := False; 54 | end; 55 | 56 | // ***************************************************************************** 57 | // Start/Stop Main Server 58 | // ***************************************************************************** 59 | procedure TForm1.btnActivateClick(Sender: TObject); 60 | begin 61 | if TCPServer.Active then 62 | begin 63 | // Deactivate the TCP Server 64 | TCPServer.Active := False; 65 | btnActivate.Caption := 'Start TCP Server'; 66 | Log('TCP Server Deactivated'); 67 | end 68 | else 69 | begin 70 | try 71 | // Activate the TCP Server 72 | TCPServer.Active := True; 73 | btnActivate.Caption := 'Stop TCP Server'; 74 | Log('TCP Server Activated at port: ' + IntToStr(TCPServer.Port)); 75 | 76 | except 77 | on E: Exception do 78 | Log('Failed to activate TCP Server: ' + E.Message); 79 | end; 80 | end; 81 | end; 82 | 83 | // ***************************************************************************** 84 | // Change Main Client port 85 | // ***************************************************************************** 86 | procedure TForm1.edtPortChange(Sender: TObject); 87 | begin 88 | try 89 | TCPServer.Port := edtPort.Value; 90 | except 91 | edtPort.OnChange := nil; 92 | try 93 | edtPort.Value := TCPServer.Port; 94 | finally 95 | edtPort.OnChange := edtPortChange; 96 | end; 97 | raise; 98 | end; 99 | end; 100 | 101 | // ***************************************************************************** 102 | // Shutdown all Clients 103 | // ***************************************************************************** 104 | procedure TForm1.btnShutdownAllClientsClick(Sender: TObject); 105 | var 106 | SocketList: TSocketList; 107 | i: Integer; 108 | begin 109 | SocketList := TCPServer.Lines.LockList; 110 | try 111 | for i := 0 to SocketList.Count - 1 do 112 | TCPServer.ShutDownLine(SocketList.Lines[i]); 113 | finally 114 | TCPServer.Lines.UnlockList; 115 | end; 116 | end; 117 | 118 | // ***************************************************************************** 119 | // TCPServerConnected 120 | // ***************************************************************************** 121 | procedure TForm1.TCPServerConnected(Sender: TObject; aLine: TncLine); 122 | begin 123 | 124 | Log('Connected: ' + aLine.PeerIP); 125 | 126 | TCPServer.Send(aLine, BytesOf('Hello mr. ' + IntToStr(aLine.Handle))); 127 | end; 128 | 129 | // ***************************************************************************** 130 | // TCPServerDisconnected 131 | // ***************************************************************************** 132 | procedure TForm1.TCPServerDisconnected(Sender: TObject; aLine: TncLine); 133 | begin 134 | 135 | Log('Disconnected: ' + aLine.PeerIP); 136 | 137 | end; 138 | 139 | // ***************************************************************************** 140 | // Read Data 141 | // ***************************************************************************** 142 | procedure TForm1.TCPServerReadData(Sender: TObject; aLine: TncLine; 143 | const aBuf: TBytes; aBufCount: Integer); 144 | var 145 | BytesReceived: TBytes; 146 | begin 147 | BytesReceived := Copy(aBuf, 0, aBufCount); 148 | 149 | Log('Received: "' + StringOf(BytesReceived) + '" from: ' + aLine.PeerIP); 150 | 151 | // Send back the buffer received 152 | TCPServer.Send(aLine, BytesReceived); 153 | 154 | Log('Data sent: ' + StringOf(BytesReceived)); 155 | 156 | end; 157 | 158 | // ***************************************************************************** 159 | // Memo Log 160 | // ***************************************************************************** 161 | procedure TForm1.Log(const AMessage: string); 162 | begin 163 | TThread.Queue(nil, 164 | procedure 165 | begin 166 | try 167 | memLog.Lines.Add(Format('[%s] %s', [FormatDateTime('hh:nn:ss.zzz', Now), 168 | AMessage])); 169 | finally 170 | end; 171 | end); 172 | end; 173 | 174 | procedure TForm1.memLogKeyDown(Sender: TObject; var Key: Word; 175 | Shift: TShiftState); 176 | begin 177 | if (Shift = [ssCtrl]) and (Key = Ord('A')) then 178 | memLog.SelectAll 179 | else if (Shift = [ssCtrl]) and (Key = Ord('C')) then 180 | memLog.CopyToClipboard; 181 | end; 182 | 183 | end. 184 | -------------------------------------------------------------------------------- /Demos/SimpleSockets/SimpleSockets.groupproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | {D340A737-6F7F-41B2-ABE1-FF55CC85A4DB} 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Default.Personality.12 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /Demos/SimpleSockets/SimpleSockets_TCPv4.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/Demos/SimpleSockets/SimpleSockets_TCPv4.PNG -------------------------------------------------------------------------------- /Demos/SimpleSockets/SimpleSockets_TCPv6.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/Demos/SimpleSockets/SimpleSockets_TCPv6.PNG -------------------------------------------------------------------------------- /Demos/SimpleSockets_UDP/Client/Client.dpr: -------------------------------------------------------------------------------- 1 | program Client; 2 | 3 | uses 4 | Vcl.Forms, 5 | ufrmMain in 'ufrmMain.pas' {Form1}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | {$IFDEF DEBUG} 11 | ReportMemoryLeaksOnShutdown := True; 12 | {$ENDIF} 13 | Application.Initialize; 14 | Application.MainFormOnTaskbar := True; 15 | Application.CreateForm(TForm1, Form1); 16 | Application.Run; 17 | end. 18 | -------------------------------------------------------------------------------- /Demos/SimpleSockets_UDP/Client/Client.dproj.local: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 2025/01/14 21:49:41.000.186,=D:\_Delphi\_Library\Netcom7\Demos\SimpleSockets_UDP\Client\Unit1.pas 8 | 2025/01/14 21:49:56.000.966,D:\_Delphi\_Library\Netcom7\Demos\SimpleSockets_UDP\Client\uMainClient.pas=D:\_Delphi\_Library\Netcom7\Demos\SimpleSockets_UDP\Client\Unit1.pas 9 | 2025/01/16 20:06:27.000.079,D:\_Delphi\_Library\NetCom7\Demos\SimpleSockets_UDP_v2\Client\uMainClient.pas= 10 | 11 | 12 | -------------------------------------------------------------------------------- /Demos/SimpleSockets_UDP/Client/Client.identcache: -------------------------------------------------------------------------------- 1 | ED:\_Delphi\_Library\Netcom7\Demos\SimpleSockets_UDP\Client\Client.dprGD:\_Delphi\_Library\Netcom7\Demos\SimpleSockets_UDP\Client\ufrmMain.pas -------------------------------------------------------------------------------- /Demos/SimpleSockets_UDP/Client/Client.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/Demos/SimpleSockets_UDP/Client/Client.res -------------------------------------------------------------------------------- /Demos/SimpleSockets_UDP/Client/Client.skincfg: -------------------------------------------------------------------------------- 1 | [ExpressSkins] 2 | Default=1 3 | ShowNotifications=1 4 | Enabled=1 5 | dxSkinBlack=1 6 | dxSkinBlue=0 7 | dxSkinCaramel=0 8 | dxSkinCoffee=0 9 | dxSkinDarkRoom=0 10 | dxSkinDarkSide=1 11 | dxSkinFoggy=0 12 | dxSkinGlassOceans=0 13 | dxSkiniMaginary=0 14 | dxSkinLilian=0 15 | dxSkinLiquidSky=0 16 | dxSkinLondonLiquidSky=0 17 | dxSkinMcSkin=0 18 | dxSkinMoneyTwins=0 19 | dxSkinOffice2007Black=1 20 | dxSkinOffice2007Blue=0 21 | dxSkinOffice2007Green=0 22 | dxSkinOffice2007Pink=0 23 | dxSkinOffice2007Silver=1 24 | dxSkinPumpkin=0 25 | dxSkinSeven=0 26 | dxSkinSharp=0 27 | dxSkinSilver=0 28 | dxSkinSpringTime=0 29 | dxSkinStardust=0 30 | dxSkinSummer2008=0 31 | dxSkinsDefaultPainters=0 32 | dxSkinValentine=0 33 | dxSkinXmas2008Blue=0 34 | -------------------------------------------------------------------------------- /Demos/SimpleSockets_UDP/Client/Client_Icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/Demos/SimpleSockets_UDP/Client/Client_Icon.ico -------------------------------------------------------------------------------- /Demos/SimpleSockets_UDP/Client/ufrmMain.dfm: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | ActiveControl = edtDataToSend 5 | Caption = 'UDPClient' 6 | ClientHeight = 243 7 | ClientWidth = 527 8 | Color = clBtnFace 9 | Font.Charset = DEFAULT_CHARSET 10 | Font.Color = clWindowText 11 | Font.Height = -11 12 | Font.Name = 'Tahoma' 13 | Font.Style = [] 14 | Position = poScreenCenter 15 | OnCreate = FormCreate 16 | OnDestroy = FormDestroy 17 | TextHeight = 13 18 | object memLog: TMemo 19 | AlignWithMargins = True 20 | Left = 5 21 | Top = 37 22 | Width = 517 23 | Height = 169 24 | Margins.Left = 5 25 | Margins.Top = 0 26 | Margins.Right = 5 27 | Margins.Bottom = 5 28 | Align = alClient 29 | ReadOnly = True 30 | ScrollBars = ssVertical 31 | TabOrder = 1 32 | OnKeyDown = memLogKeyDown 33 | ExplicitWidth = 515 34 | ExplicitHeight = 161 35 | end 36 | object pnlToolbar: TPanel 37 | Left = 0 38 | Top = 0 39 | Width = 527 40 | Height = 37 41 | Align = alTop 42 | BevelOuter = bvNone 43 | FullRepaint = False 44 | TabOrder = 0 45 | ExplicitWidth = 525 46 | object btnActivate: TButton 47 | AlignWithMargins = True 48 | Left = 5 49 | Top = 5 50 | Width = 105 51 | Height = 27 52 | Margins.Left = 5 53 | Margins.Top = 5 54 | Margins.Right = 0 55 | Margins.Bottom = 5 56 | Align = alLeft 57 | Caption = 'Start UDP Client' 58 | TabOrder = 0 59 | OnClick = btnActivateClick 60 | end 61 | object pnlAddress: TPanel 62 | AlignWithMargins = True 63 | Left = 110 64 | Top = 3 65 | Width = 417 66 | Height = 31 67 | Margins.Left = 0 68 | Margins.Right = 0 69 | Align = alClient 70 | BevelOuter = bvNone 71 | FullRepaint = False 72 | TabOrder = 1 73 | ExplicitWidth = 415 74 | object edtHost: TEdit 75 | AlignWithMargins = True 76 | Left = 5 77 | Top = 5 78 | Width = 281 79 | Height = 21 80 | Margins.Left = 5 81 | Margins.Top = 5 82 | Margins.Right = 5 83 | Margins.Bottom = 5 84 | Align = alClient 85 | TabOrder = 0 86 | TextHint = 'Enter host address' 87 | OnChange = edtHostChange 88 | ExplicitWidth = 279 89 | end 90 | object edtPort: TSpinEdit 91 | AlignWithMargins = True 92 | Left = 291 93 | Top = 5 94 | Width = 121 95 | Height = 22 96 | Margins.Left = 0 97 | Margins.Top = 5 98 | Margins.Right = 5 99 | Margins.Bottom = 5 100 | Align = alRight 101 | MaxValue = 0 102 | MinValue = 0 103 | TabOrder = 1 104 | Value = 16233 105 | OnChange = edtPortChange 106 | ExplicitLeft = 289 107 | end 108 | end 109 | end 110 | object Panel1: TPanel 111 | Left = 0 112 | Top = 211 113 | Width = 527 114 | Height = 32 115 | Margins.Left = 5 116 | Margins.Top = 0 117 | Margins.Right = 5 118 | Margins.Bottom = 5 119 | Align = alBottom 120 | BevelOuter = bvNone 121 | FullRepaint = False 122 | TabOrder = 2 123 | ExplicitTop = 203 124 | ExplicitWidth = 525 125 | object btnSendData: TButton 126 | AlignWithMargins = True 127 | Left = 5 128 | Top = 0 129 | Width = 105 130 | Height = 27 131 | Margins.Left = 5 132 | Margins.Top = 0 133 | Margins.Right = 0 134 | Margins.Bottom = 5 135 | Align = alLeft 136 | Caption = 'Send' 137 | Default = True 138 | TabOrder = 0 139 | OnClick = btnSendDataClick 140 | end 141 | object Panel2: TPanel 142 | AlignWithMargins = True 143 | Left = 110 144 | Top = 3 145 | Width = 417 146 | Height = 26 147 | Margins.Left = 0 148 | Margins.Right = 0 149 | Align = alClient 150 | BevelOuter = bvNone 151 | FullRepaint = False 152 | TabOrder = 1 153 | ExplicitWidth = 415 154 | object edtDataToSend: TEdit 155 | AlignWithMargins = True 156 | Left = 5 157 | Top = 0 158 | Width = 407 159 | Height = 21 160 | Margins.Left = 5 161 | Margins.Top = 0 162 | Margins.Right = 5 163 | Margins.Bottom = 5 164 | Align = alClient 165 | TabOrder = 0 166 | Text = 'This is some text data' 167 | TextHint = 'Enter data to send here' 168 | OnEnter = edtDataToSendEnter 169 | OnExit = edtDataToSendExit 170 | ExplicitWidth = 405 171 | end 172 | end 173 | end 174 | object UDPClient: TncUDPClient 175 | Family = afIPv6 176 | OnReadDatagram = UDPClientReadDatagram 177 | Left = 216 178 | Top = 96 179 | end 180 | end 181 | -------------------------------------------------------------------------------- /Demos/SimpleSockets_UDP/Client/ufrmMain.pas: -------------------------------------------------------------------------------- 1 | unit ufrmMain; 2 | 3 | interface 4 | 5 | uses 6 | {$IFDEF MSWINDOWS} 7 | WinApi.Windows, WinApi.Winsock2, 8 | {$ELSE} 9 | Posix.SysSocket, Posix.Unistd, 10 | {$ENDIF} 11 | System.Classes, System.SysUtils, Vcl.Forms, Vcl.Controls, Vcl.StdCtrls, 12 | Vcl.ExtCtrls, Vcl.Samples.Spin, 13 | System.Diagnostics, ncLines, ncUDPSockets, ncIPUtils; 14 | 15 | type 16 | TForm1 = class(TForm) 17 | memLog: TMemo; 18 | pnlToolbar: TPanel; 19 | btnActivate: TButton; 20 | pnlAddress: TPanel; 21 | edtHost: TEdit; 22 | edtPort: TSpinEdit; 23 | Panel1: TPanel; 24 | btnSendData: TButton; 25 | Panel2: TPanel; 26 | edtDataToSend: TEdit; 27 | UDPClient: TncUDPClient; 28 | procedure FormCreate(Sender: TObject); 29 | procedure FormDestroy(Sender: TObject); 30 | procedure btnActivateClick(Sender: TObject); 31 | procedure edtHostChange(Sender: TObject); 32 | procedure edtPortChange(Sender: TObject); 33 | procedure edtDataToSendEnter(Sender: TObject); 34 | procedure edtDataToSendExit(Sender: TObject); 35 | procedure Log(const AMessage: string); 36 | procedure memLogKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); 37 | procedure btnSendDataClick(Sender: TObject); 38 | procedure UDPClientReadDatagram(Sender: TObject; aLine: TncLine; 39 | const aBuf: TBytes; aBufCount: Integer; 40 | const SenderAddr: TSockAddrStorage); 41 | 42 | private 43 | { Private declarations } 44 | public 45 | { Public declarations } 46 | end; 47 | 48 | var 49 | Form1: TForm1; 50 | 51 | implementation 52 | 53 | {$R *.dfm} 54 | 55 | procedure TForm1.FormCreate(Sender: TObject); 56 | begin 57 | // 58 | end; 59 | 60 | procedure TForm1.FormDestroy(Sender: TObject); 61 | begin 62 | UDPClient.Active := False; 63 | end; 64 | 65 | // ***************************************************************************** 66 | // Start/Stop Main CLient 67 | // ***************************************************************************** 68 | procedure TForm1.btnActivateClick(Sender: TObject); 69 | begin 70 | if UDPClient.Active then 71 | begin 72 | // Deactivate the UDP client 73 | UDPClient.Active := False; 74 | btnActivate.Caption := 'Start UDP Client'; 75 | Log('UDP Client Deactivated'); 76 | end 77 | else 78 | begin 79 | // Check if the host field is blank 80 | if Trim(edtHost.Text) = '' then 81 | begin 82 | Log('Host field cannot be blank.'); 83 | Exit; // Exit the procedure if the host field is blank 84 | end; 85 | 86 | try 87 | // Set the host from the text field 88 | UDPClient.Host := edtHost.Text; 89 | 90 | // Activate the UDP client 91 | UDPClient.Active := True; 92 | btnActivate.Caption := 'Stop UDP Client'; 93 | Log('UDP Client Activated'); 94 | except 95 | on E: Exception do 96 | Log('Failed to activate UDP Client: ' + E.Message); 97 | end; 98 | end; 99 | end; 100 | 101 | // ***************************************************************************** 102 | // Change host (server) 103 | // ***************************************************************************** 104 | procedure TForm1.edtHostChange(Sender: TObject); 105 | begin 106 | try 107 | UDPClient.Host := edtHost.Text; 108 | except 109 | edtHost.OnChange := nil; 110 | try 111 | edtHost.Text := UDPClient.Host; 112 | finally 113 | edtHost.OnChange := edtHostChange; 114 | end; 115 | raise; 116 | end; 117 | end; 118 | 119 | // ***************************************************************************** 120 | // Change Main Client port 121 | // ***************************************************************************** 122 | procedure TForm1.edtPortChange(Sender: TObject); 123 | begin 124 | try 125 | UDPClient.Port := edtPort.Value; 126 | except 127 | edtPort.OnChange := nil; 128 | try 129 | edtPort.Value := UDPClient.Port; 130 | finally 131 | edtPort.OnChange := edtPortChange; 132 | end; 133 | raise; 134 | end; 135 | end; 136 | 137 | // ***************************************************************************** 138 | // Data to send 139 | // ***************************************************************************** 140 | procedure TForm1.edtDataToSendEnter(Sender: TObject); 141 | begin 142 | btnSendData.Default := True; 143 | end; 144 | 145 | procedure TForm1.edtDataToSendExit(Sender: TObject); 146 | begin 147 | btnSendData.Default := False; 148 | end; 149 | 150 | procedure TForm1.btnSendDataClick(Sender: TObject); 151 | begin 152 | try 153 | // Ensure the client is active 154 | if not UDPClient.Active then 155 | begin 156 | Log('Cannot send - client not active'); 157 | Exit; 158 | end; 159 | 160 | // Ensure the input field is not empty 161 | if Trim(edtDataToSend.Text) = '' then 162 | begin 163 | Log('Cannot send - Data field cannot be blank.'); 164 | Exit; 165 | end; 166 | 167 | // Send the data if all conditions are met 168 | UDPClient.Send(edtDataToSend.Text); 169 | Log(Format('Data sent: %s', [edtDataToSend.Text])); 170 | except 171 | on E: Exception do 172 | Log('Error sending: ' + E.Message); 173 | end; 174 | end; 175 | 176 | // ***************************************************************************** 177 | // Read Data 178 | // ***************************************************************************** 179 | procedure TForm1.UDPClientReadDatagram(Sender: TObject; aLine: TncLine; 180 | const aBuf: TBytes; aBufCount: Integer; const SenderAddr: TSockAddrStorage); 181 | var 182 | ReceivedData: string; 183 | BytesReceived: TBytes; 184 | SenderIP: string; 185 | begin 186 | // Convert received data to string 187 | ReceivedData := StringOf(Copy(aBuf, 0, aBufCount)); 188 | 189 | // Get sender IP address using our utils 190 | try 191 | SenderIP := TncIPUtils.GetIPFromStorage(SenderAddr); 192 | except 193 | on E: EIPError do 194 | SenderIP := Format('Invalid Address: %s', [E.Message]); 195 | end; 196 | 197 | Form1.Log(Format('Received from %s: %s', [SenderIP, ReceivedData])); 198 | end; 199 | 200 | // ***************************************************************************** 201 | // Memo Log 202 | // ***************************************************************************** 203 | procedure TForm1.Log(const AMessage: string); 204 | begin 205 | TThread.Queue(nil, 206 | procedure 207 | begin 208 | try 209 | memLog.Lines.Add(Format('[%s] %s', [FormatDateTime('hh:nn:ss.zzz', Now), 210 | AMessage])); 211 | finally 212 | end; 213 | end); 214 | end; 215 | 216 | procedure TForm1.memLogKeyDown(Sender: TObject; var Key: Word; 217 | Shift: TShiftState); 218 | begin 219 | if (Shift = [ssCtrl]) and (Key = Ord('A')) then 220 | memLog.SelectAll 221 | else if (Shift = [ssCtrl]) and (Key = Ord('C')) then 222 | memLog.CopyToClipboard; 223 | end; 224 | 225 | end. 226 | -------------------------------------------------------------------------------- /Demos/SimpleSockets_UDP/Server/Server.dpr: -------------------------------------------------------------------------------- 1 | program Server; 2 | 3 | uses 4 | Vcl.Forms, 5 | ufrmMain in 'ufrmMain.pas' {frmMain}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | {$IFDEF DEBUG} 11 | ReportMemoryLeaksOnShutdown := True; 12 | {$ENDIF} 13 | Application.Initialize; 14 | Application.MainFormOnTaskbar := True; 15 | Application.CreateForm(TForm1, Form1); 16 | Application.Run; 17 | end. 18 | 19 | 20 | -------------------------------------------------------------------------------- /Demos/SimpleSockets_UDP/Server/Server.dproj.local: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 2025/01/14 22:17:15.000.403,=D:\_Delphi\_Library\Netcom7\Demos\SimpleSockets_UDP\Server\Unit1.pas 8 | 2025/01/14 22:17:30.000.252,D:\_Delphi\_Library\Netcom7\Demos\SimpleSockets_UDP\Server\uMainServer.pas=D:\_Delphi\_Library\Netcom7\Demos\SimpleSockets_UDP\Server\Unit1.pas 9 | 2025/01/16 20:08:59.000.762,D:\_Delphi\_Library\NetCom7\Demos\SimpleSockets_UDP_v2\Server\uMainServer.pas= 10 | 11 | 12 | -------------------------------------------------------------------------------- /Demos/SimpleSockets_UDP/Server/Server.identcache: -------------------------------------------------------------------------------- 1 | GD:\_Delphi\_Library\Netcom7\Demos\SimpleSockets_UDP\Server\ufrmMain.pasED:\_Delphi\_Library\Netcom7\Demos\SimpleSockets_UDP\Server\Server.dpr -------------------------------------------------------------------------------- /Demos/SimpleSockets_UDP/Server/Server.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/Demos/SimpleSockets_UDP/Server/Server.res -------------------------------------------------------------------------------- /Demos/SimpleSockets_UDP/Server/Server.skincfg: -------------------------------------------------------------------------------- 1 | [ExpressSkins] 2 | Default=1 3 | ShowNotifications=1 4 | Enabled=1 5 | dxSkinBlack=1 6 | dxSkinBlue=0 7 | dxSkinCaramel=0 8 | dxSkinCoffee=0 9 | dxSkinDarkRoom=0 10 | dxSkinDarkSide=1 11 | dxSkinFoggy=0 12 | dxSkinGlassOceans=0 13 | dxSkiniMaginary=0 14 | dxSkinLilian=0 15 | dxSkinLiquidSky=0 16 | dxSkinLondonLiquidSky=0 17 | dxSkinMcSkin=0 18 | dxSkinMoneyTwins=0 19 | dxSkinOffice2007Black=1 20 | dxSkinOffice2007Blue=0 21 | dxSkinOffice2007Green=0 22 | dxSkinOffice2007Pink=0 23 | dxSkinOffice2007Silver=1 24 | dxSkinPumpkin=0 25 | dxSkinSeven=0 26 | dxSkinSharp=0 27 | dxSkinSilver=0 28 | dxSkinSpringTime=0 29 | dxSkinStardust=0 30 | dxSkinSummer2008=0 31 | dxSkinsDefaultPainters=0 32 | dxSkinValentine=0 33 | dxSkinXmas2008Blue=0 34 | -------------------------------------------------------------------------------- /Demos/SimpleSockets_UDP/Server/Server_Icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/Demos/SimpleSockets_UDP/Server/Server_Icon.ico -------------------------------------------------------------------------------- /Demos/SimpleSockets_UDP/Server/ufrmMain.dfm: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'UDPServer' 5 | ClientHeight = 244 6 | ClientWidth = 527 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | Position = poScreenCenter 14 | OnCreate = FormCreate 15 | OnDestroy = FormDestroy 16 | TextHeight = 13 17 | object memLog: TMemo 18 | AlignWithMargins = True 19 | Left = 5 20 | Top = 37 21 | Width = 517 22 | Height = 202 23 | Margins.Left = 5 24 | Margins.Top = 0 25 | Margins.Right = 5 26 | Margins.Bottom = 5 27 | Align = alClient 28 | ReadOnly = True 29 | ScrollBars = ssVertical 30 | TabOrder = 0 31 | OnKeyDown = memLogKeyDown 32 | ExplicitWidth = 515 33 | ExplicitHeight = 194 34 | end 35 | object pnlToolbar: TPanel 36 | Left = 0 37 | Top = 0 38 | Width = 527 39 | Height = 37 40 | Align = alTop 41 | BevelOuter = bvNone 42 | FullRepaint = False 43 | TabOrder = 1 44 | ExplicitWidth = 525 45 | object btnActivate: TButton 46 | AlignWithMargins = True 47 | Left = 5 48 | Top = 5 49 | Width = 105 50 | Height = 27 51 | Margins.Left = 5 52 | Margins.Top = 5 53 | Margins.Right = 5 54 | Margins.Bottom = 5 55 | Align = alLeft 56 | Caption = 'Start UDP Server' 57 | TabOrder = 0 58 | OnClick = btnActivateClick 59 | end 60 | object pblPort: TPanel 61 | AlignWithMargins = True 62 | Left = 115 63 | Top = 3 64 | Width = 412 65 | Height = 31 66 | Margins.Left = 0 67 | Margins.Right = 0 68 | Align = alClient 69 | BevelOuter = bvNone 70 | FullRepaint = False 71 | TabOrder = 1 72 | ExplicitWidth = 410 73 | object edtPort: TSpinEdit 74 | AlignWithMargins = True 75 | Left = 0 76 | Top = 5 77 | Width = 121 78 | Height = 22 79 | Margins.Left = 0 80 | Margins.Top = 5 81 | Margins.Right = 5 82 | Margins.Bottom = 5 83 | Align = alLeft 84 | MaxValue = 0 85 | MinValue = 0 86 | TabOrder = 0 87 | Value = 16233 88 | OnChange = edtPortChange 89 | end 90 | end 91 | end 92 | object UDPServer: TncUDPServer 93 | Family = afIPv6 94 | OnReadDatagram = UDPServerReadDatagram 95 | Left = 232 96 | Top = 104 97 | end 98 | end 99 | -------------------------------------------------------------------------------- /Demos/SimpleSockets_UDP/Server/ufrmMain.pas: -------------------------------------------------------------------------------- 1 | unit ufrmMain; 2 | 3 | interface 4 | 5 | uses 6 | {$IFDEF MSWINDOWS} 7 | WinApi.Windows, WinApi.Winsock2, 8 | {$ELSE} 9 | Posix.SysSocket, Posix.Unistd, 10 | {$ENDIF} 11 | System.Classes, System.SysUtils, Vcl.Forms, Vcl.Controls, Vcl.StdCtrls, 12 | Vcl.ExtCtrls, Vcl.Samples.Spin, System.Diagnostics, 13 | ncLines, ncUDPSockets, ncIPUtils; 14 | 15 | type 16 | TForm1 = class(TForm) 17 | memLog: TMemo; 18 | pnlToolbar: TPanel; 19 | btnActivate: TButton; 20 | pblPort: TPanel; 21 | edtPort: TSpinEdit; 22 | UDPServer: TncUDPServer; 23 | procedure FormCreate(Sender: TObject); 24 | procedure FormDestroy(Sender: TObject); 25 | procedure btnActivateClick(Sender: TObject); 26 | procedure Log(const AMessage: string); 27 | procedure memLogKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); 28 | procedure edtPortChange(Sender: TObject); 29 | procedure SendToClient(const Data: string; const DestAddr: TSockAddrStorage); 30 | procedure UDPServerReadDatagram(Sender: TObject; aLine: TncLine; 31 | const aBuf: TBytes; aBufCount: Integer; 32 | const SenderAddr: TSockAddrStorage); 33 | public 34 | end; 35 | 36 | var 37 | Form1: TForm1; 38 | 39 | implementation 40 | 41 | {$R *.dfm} 42 | 43 | procedure TForm1.FormCreate(Sender: TObject); 44 | begin 45 | // 46 | end; 47 | 48 | procedure TForm1.FormDestroy(Sender: TObject); 49 | begin 50 | UDPServer.Active := False; 51 | end; 52 | 53 | // ***************************************************************************** 54 | // Start/Stop Main CLient 55 | // ***************************************************************************** 56 | procedure TForm1.btnActivateClick(Sender: TObject); 57 | begin 58 | if UDPServer.Active then 59 | begin 60 | // Deactivate the UDP client 61 | UDPServer.Active := False; 62 | btnActivate.Caption := 'Start UDP Server'; 63 | Form1.Log('UDP Server Deactivated'); 64 | end 65 | else 66 | begin 67 | try 68 | // Activate the UDP client 69 | UDPServer.Active := True; 70 | btnActivate.Caption := 'Stop UDP Server'; 71 | Form1.Log('UDP Server Activated'); 72 | except 73 | on E: Exception do 74 | Form1.Log('Failed to activate UDP Server: ' + E.Message); 75 | end; 76 | end; 77 | end; 78 | 79 | // ***************************************************************************** 80 | // Change Main Server port 81 | // ***************************************************************************** 82 | procedure TForm1.edtPortChange(Sender: TObject); 83 | begin 84 | try 85 | UDPServer.Port := edtPort.Value; 86 | except 87 | edtPort.OnChange := nil; 88 | try 89 | edtPort.Value := UDPServer.Port; 90 | finally 91 | edtPort.OnChange := edtPortChange; 92 | end; 93 | raise; 94 | end; 95 | end; 96 | 97 | // ***************************************************************************** 98 | // SendToClient 99 | // ***************************************************************************** 100 | procedure TForm1.SendToClient(const Data: string; const DestAddr: TSockAddrStorage); 101 | var 102 | SenderIP: string; 103 | begin 104 | if not UDPServer.Active then 105 | Exit; 106 | 107 | try 108 | // Get IP address using our utils 109 | SenderIP := TncIPUtils.GetIPFromStorage(DestAddr); 110 | 111 | // Send the data - pass TSockAddrStorage directly 112 | UDPServer.SendTo(BytesOf(Data), DestAddr); 113 | 114 | Form1.Log(Format('Sent to %s: %s', [SenderIP, Data])); 115 | except 116 | on E: Exception do 117 | Form1.Log('Error sending data: ' + E.Message); 118 | end; 119 | end; 120 | 121 | // ***************************************************************************** 122 | // Read Data 123 | // ***************************************************************************** 124 | procedure TForm1.UDPServerReadDatagram(Sender: TObject; aLine: TncLine; 125 | const aBuf: TBytes; aBufCount: Integer; const SenderAddr: TSockAddrStorage); 126 | var 127 | ReceivedData: string; 128 | SenderIP: string; 129 | begin 130 | try 131 | // Convert received data to string 132 | ReceivedData := StringOf(Copy(aBuf, 0, aBufCount)); 133 | 134 | // Get sender IP address using our utils 135 | SenderIP := TncIPUtils.GetIPFromStorage(SenderAddr); 136 | 137 | // Log and echo 138 | Form1.Log(Format('Received from %s: %s', [SenderIP, ReceivedData])); 139 | SendToClient('Echo: ' + ReceivedData, SenderAddr); 140 | except 141 | on E: Exception do 142 | Form1.Log(Format('Error processing datagram: %s', [E.Message])); 143 | end; 144 | end; 145 | 146 | // ***************************************************************************** 147 | // Memo Log 148 | // ***************************************************************************** 149 | procedure TForm1.Log(const AMessage: string); 150 | begin 151 | TThread.Queue(nil, 152 | procedure 153 | begin 154 | try 155 | memLog.Lines.Add(Format('[%s] %s', [FormatDateTime('hh:nn:ss.zzz', Now), 156 | AMessage])); 157 | finally 158 | end; 159 | end); 160 | end; 161 | 162 | procedure TForm1.memLogKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); 163 | begin 164 | if (Shift = [ssCtrl]) and (Key = Ord('A')) then 165 | memLog.SelectAll 166 | else if (Shift = [ssCtrl]) and (Key = Ord('C')) then 167 | memLog.CopyToClipboard; 168 | end; 169 | 170 | end. 171 | -------------------------------------------------------------------------------- /Demos/SimpleSockets_UDP/SimpleSockets_UDP.groupproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | {7EB9A25E-4A42-4DE8-919E-70124E14615F} 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Default.Personality.12 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /Demos/SimpleSockets_UDP/SimpleSockets_UDPv4.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/Demos/SimpleSockets_UDP/SimpleSockets_UDPv4.PNG -------------------------------------------------------------------------------- /Demos/SimpleSockets_UDP/SimpleSockets_UDPv6.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/Demos/SimpleSockets_UDP/SimpleSockets_UDPv6.PNG -------------------------------------------------------------------------------- /Demos/VideoChat/Client/AndroidManifest.template.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | <%uses-permission%> 11 | 12 | 21 | 22 | <%provider%> 23 | <%application-meta-data%> 24 | <%services%> 25 | 27 | 31 | 32 | 34 | 35 | 36 | 37 | 38 | 39 | <%activity%> 40 | <%receivers%> 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /Demos/VideoChat/Client/VideoChatClient.dpr: -------------------------------------------------------------------------------- 1 | program VideoChatClient; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.Forms, 6 | FMX.Types, 7 | ufrmMain in 'ufrmMain.pas' {frmMain}, 8 | CommonCommands in '..\Server\CommonCommands.pas'; 9 | 10 | {$R *.res} 11 | 12 | begin 13 | {$IFDEF DEBUG} 14 | ReportMemoryLeaksOnShutdown := True; 15 | {$ENDIF} 16 | Application.Initialize; 17 | Application.CreateForm(TfrmMain, frmMain); 18 | Application.Run; 19 | end. 20 | -------------------------------------------------------------------------------- /Demos/VideoChat/Client/VideoChatClient.dproj.local: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 2018/09/21 12:49:51.000.179,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 5 | 2018/09/24 13:18:27.000.279,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 6 | 2018/10/10 13:56:06.000.238,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 7 | 2018/10/16 10:56:54.000.938,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 8 | 2018/10/16 11:40:09.000.191,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 9 | 2018/11/04 15:48:45.000.203,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 10 | 2018/11/04 16:17:18.000.148,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 11 | 2018/11/04 16:17:48.000.272,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 12 | 2018/11/23 20:02:18.000.772,=C:\Users\Programmer\Documents\Development\Projects\Unit2.pas 13 | 2019/02/27 18:05:16.000.392,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 14 | 2019/02/27 18:06:31.000.995,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 15 | 2019/02/27 18:12:19.000.197,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 16 | 2019/03/05 12:15:54.000.434,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 17 | 2019/03/05 13:06:38.000.677,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 18 | 2019/03/11 18:09:12.000.176,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 19 | 2019/03/25 16:12:14.000.258,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 20 | 2019/05/29 14:49:59.000.196,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 21 | 2019/05/31 18:08:29.000.138,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 22 | 2019/08/21 21:29:49.000.507,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 23 | 2019/09/18 13:39:12.000.759,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 24 | 2019/11/09 19:07:03.000.902,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 25 | 2019/12/15 14:13:57.000.985,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 26 | 2020/04/13 08:49:52.000.721,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 27 | 2020/04/14 04:39:08.000.542,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 28 | 2020/04/15 03:31:58.000.910,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 29 | 2020/07/02 09:58:25.000.183,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 30 | 2020/07/02 20:01:51.000.926,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 31 | 2020/07/05 15:55:38.000.562,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 32 | 2020/07/08 18:03:33.000.205,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 33 | 2020/07/16 00:09:13.000.392,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 34 | 2020/08/07 10:38:54.000.477,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 35 | 2020/08/08 10:30:32.000.363,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 36 | 2020/08/10 13:26:25.000.247,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 37 | 2020/08/12 00:19:14.000.567,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 38 | 2020/08/12 09:24:02.000.042,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 39 | 2020/08/12 09:29:13.000.265,C:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\VideoChat\Client\ufrmMain.pas=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 40 | 2020/08/12 09:29:13.000.265,C:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\VideoChat\Client\ufrmMain.fmx=C:\Users\Programmer\Documents\Development\Projects\Unit3.fmx 41 | 2020/08/12 09:29:28.000.515,C:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\VideoChat\Client\VideoChatClient.dproj=C:\Users\Programmer\Documents\Development\Projects\Project1.dproj 42 | 2020/08/12 10:06:25.000.279,=C:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\VideoChat\Client\Unit1.pas 43 | 2020/08/12 10:06:52.000.317,C:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\VideoChat\Server\CommonCommands.pas=C:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\VideoChat\Client\Unit1.pas 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /Demos/VideoChat/Client/VideoChatClient.identcache: -------------------------------------------------------------------------------- 1 | `C:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\VideoChat\Client\ufrmMain.pasfC:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\VideoChat\Server\CommonCommands.pasgC:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\VideoChat\Client\VideoChatClient.dpr -------------------------------------------------------------------------------- /Demos/VideoChat/Client/VideoChatClient.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/Demos/VideoChat/Client/VideoChatClient.res -------------------------------------------------------------------------------- /Demos/VideoChat/Server/AndroidManifest.template.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | <%uses-permission%> 11 | 12 | 21 | 22 | <%provider%> 23 | <%application-meta-data%> 24 | <%services%> 25 | 27 | 31 | 32 | 34 | 35 | 36 | 37 | 38 | 39 | <%activity%> 40 | <%receivers%> 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /Demos/VideoChat/Server/CommonCommands.pas: -------------------------------------------------------------------------------- 1 | unit CommonCommands; 2 | 3 | interface 4 | 5 | const 6 | cmdCntUserLogin = 0; 7 | cmdSrvUpdateLoggedInUsers = 1; 8 | cmdCntCameraImage = 2; 9 | cmdSrvUpdateImage = 3; 10 | cmdCntGetText = 4; 11 | cmdSrvGetText = 5; 12 | 13 | implementation 14 | 15 | end. 16 | -------------------------------------------------------------------------------- /Demos/VideoChat/Server/VideoChatServer.dpr: -------------------------------------------------------------------------------- 1 | program VideoChatServer; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.Forms, 6 | ufrmMain in 'ufrmMain.pas' {frmMain}, 7 | CommonCommands in 'CommonCommands.pas'; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | {$IFDEF DEBUG} 13 | ReportMemoryLeaksOnShutdown := True; 14 | {$ENDIF} 15 | Application.Initialize; 16 | Application.CreateForm(TfrmMain, frmMain); 17 | Application.Run; 18 | end. 19 | -------------------------------------------------------------------------------- /Demos/VideoChat/Server/VideoChatServer.dproj.local: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 2018/09/21 12:49:51.000.179,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 5 | 2018/09/24 13:18:27.000.279,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 6 | 2018/10/10 13:56:06.000.238,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 7 | 2018/10/16 10:56:54.000.938,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 8 | 2018/10/16 11:40:09.000.191,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 9 | 2018/11/04 15:48:45.000.203,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 10 | 2018/11/04 16:17:18.000.148,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 11 | 2018/11/04 16:17:48.000.272,=C:\Users\Programmer\Documents\Development\Projects\Unit1.pas 12 | 2018/11/23 20:02:18.000.772,=C:\Users\Programmer\Documents\Development\Projects\Unit2.pas 13 | 2019/02/27 18:05:16.000.392,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 14 | 2019/02/27 18:06:31.000.995,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 15 | 2019/02/27 18:12:19.000.197,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 16 | 2019/03/05 12:15:54.000.434,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 17 | 2019/03/05 13:06:38.000.677,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 18 | 2019/03/11 18:09:12.000.176,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 19 | 2019/03/25 16:12:14.000.258,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 20 | 2019/05/29 14:49:59.000.196,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 21 | 2019/05/31 18:08:29.000.138,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 22 | 2019/08/21 21:29:49.000.507,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 23 | 2019/09/18 13:39:12.000.759,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 24 | 2019/11/09 19:07:03.000.902,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 25 | 2019/12/15 14:13:57.000.985,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 26 | 2020/04/13 08:49:52.000.721,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 27 | 2020/04/14 04:39:08.000.542,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 28 | 2020/04/15 03:31:58.000.910,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 29 | 2020/07/02 09:58:25.000.183,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 30 | 2020/07/02 20:01:51.000.926,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 31 | 2020/07/05 15:55:38.000.562,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 32 | 2020/07/08 18:03:33.000.205,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 33 | 2020/07/16 00:09:13.000.392,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 34 | 2020/08/07 10:38:54.000.477,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 35 | 2020/08/08 10:30:32.000.363,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 36 | 2020/08/10 13:26:25.000.247,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 37 | 2020/08/12 00:19:14.000.567,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 38 | 2020/08/12 09:20:35.000.938,=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 39 | 2020/08/12 09:22:06.000.529,C:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\VideoChat\Server\ufrmMain.fmx=C:\Users\Programmer\Documents\Development\Projects\Unit3.fmx 40 | 2020/08/12 09:22:06.000.529,C:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\VideoChat\Server\ufrmMain.pas=C:\Users\Programmer\Documents\Development\Projects\Unit3.pas 41 | 2020/08/12 09:22:13.000.248,C:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\VideoChat\Server\VideoChatServer.dproj=C:\Users\Programmer\Documents\Development\Projects\Project1.dproj 42 | 2020/08/12 10:07:55.000.801,=C:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\VideoChat\Server\CommonCommands.pas 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Demos/VideoChat/Server/VideoChatServer.identcache: -------------------------------------------------------------------------------- 1 | `C:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\VideoChat\Server\ufrmMain.pasfC:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\VideoChat\Server\CommonCommands.pasgC:\Users\Programmer\Documents\Development\Components\NetCom7\Demos\VideoChat\Server\VideoChatServer.dpr -------------------------------------------------------------------------------- /Demos/VideoChat/Server/VideoChatServer.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/Demos/VideoChat/Server/VideoChatServer.res -------------------------------------------------------------------------------- /Demos/VideoChat/Server/ufrmMain.fmx: -------------------------------------------------------------------------------- 1 | object frmMain: TfrmMain 2 | Left = 0 3 | Top = 0 4 | Caption = 'NetCom Video Chat Server' 5 | ClientHeight = 480 6 | ClientWidth = 640 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | OnCreate = FormCreate 11 | OnDestroy = FormDestroy 12 | DesignerMasterStyle = 0 13 | object memLog: TMemo 14 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 15 | DataDetectorTypes = [] 16 | Align = Client 17 | Size.Width = 640.000000000000000000 18 | Size.Height = 480.000000000000000000 19 | Size.PlatformDefault = False 20 | TabOrder = 1 21 | Viewport.Width = 636.000000000000000000 22 | Viewport.Height = 476.000000000000000000 23 | end 24 | object Server: TncServerSource 25 | Port = 17244 26 | CommandProcessorThreadsPerCPU = 2 27 | CommandProcessorThreadsGrowUpto = 20 28 | ExecCommandTimeout = 2000 29 | EncryptionKey = 'SetEncryptionKey' 30 | OnConnected = ServerConnected 31 | OnDisconnected = ServerDisconnected 32 | OnHandleCommand = ServerHandleCommand 33 | Left = 40 34 | Top = 40 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /Demos/VideoChat/Server/ufrmMain.pas: -------------------------------------------------------------------------------- 1 | unit ufrmMain; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, 7 | FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, 8 | FMX.Controls.Presentation, FMX.ScrollBox, FMX.Memo, 9 | System.SyncObjs, ncSocketList, ncSources, CommonCommands; 10 | 11 | type 12 | TConnectedUserData = class 13 | Line: TncLine; 14 | Image: TBitmap; 15 | end; 16 | 17 | TfrmMain = class(TForm) 18 | Server: TncServerSource; 19 | memLog: TMemo; 20 | procedure FormCreate(Sender: TObject); 21 | procedure FormDestroy(Sender: TObject); 22 | function ServerHandleCommand(Sender: TObject; aLine: TncLine; aCmd: Integer; const aData: TArray; aRequiresResult: Boolean; 23 | const aSenderComponent, aReceiverComponent: string): TArray; 24 | procedure ServerDisconnected(Sender: TObject; aLine: TncLine); 25 | procedure ServerConnected(Sender: TObject; aLine: TncLine); 26 | private 27 | ConnectedUsersLock: TCriticalSection; 28 | ConnectedUsers: TStringList; 29 | procedure InformClientsOfLogins(aDontSendToLine: TncLine = nil); 30 | public 31 | end; 32 | 33 | var 34 | frmMain: TfrmMain; 35 | 36 | implementation 37 | 38 | {$R *.fmx} 39 | 40 | procedure TfrmMain.FormCreate(Sender: TObject); 41 | begin 42 | ConnectedUsersLock := TCriticalSection.Create; 43 | 44 | ConnectedUsers := TStringList.Create; 45 | ConnectedUsers.Sorted := True; 46 | ConnectedUsers.Duplicates := dupError; 47 | ConnectedUsers.CaseSensitive := False; 48 | 49 | try 50 | Server.Active := True; 51 | memLog.Lines.Add('Server started! Do not close this window'); 52 | except 53 | on e: Exception do 54 | memLog.Lines.Add('Cannot start server: ' + e.Message); 55 | end; 56 | end; 57 | 58 | procedure TfrmMain.FormDestroy(Sender: TObject); 59 | begin 60 | Server.Active := False; 61 | ConnectedUsers.Free; 62 | ConnectedUsersLock.Free; 63 | end; 64 | 65 | procedure TfrmMain.ServerConnected(Sender: TObject; aLine: TncLine); 66 | begin 67 | TThread.Synchronize(nil, 68 | procedure 69 | begin 70 | memLog.Lines.Add(aLine.PeerIP + ' Client connected'); 71 | memLog.ScrollBy(0, 100); 72 | end); 73 | end; 74 | 75 | procedure TfrmMain.ServerDisconnected(Sender: TObject; aLine: TncLine); 76 | var 77 | i: Integer; 78 | UserData: TConnectedUserData; 79 | begin 80 | TThread.Synchronize(nil, 81 | procedure 82 | begin 83 | memLog.Lines.Add(aLine.PeerIP + ' Client disconnected'); 84 | memLog.ScrollBy(0, 100); 85 | end); 86 | 87 | // Check Connected Users list to delete the entry 88 | ConnectedUsersLock.Acquire; 89 | try 90 | for i := 0 to ConnectedUsers.Count - 1 do 91 | begin 92 | UserData := TConnectedUserData(ConnectedUsers.Objects[i]); 93 | if UserData.Line = aLine then 94 | begin 95 | UserData.Image.Free; 96 | UserData.Free; 97 | ConnectedUsers.Delete(i); 98 | Break; 99 | end; 100 | end; 101 | finally 102 | ConnectedUsersLock.Release; 103 | end; 104 | 105 | InformClientsOfLogins(aLine); 106 | end; 107 | 108 | // DontSendTo parameter is used by disconnect, so that we don't send the 109 | // disconnected line the message 110 | procedure TfrmMain.InformClientsOfLogins(aDontSendToLine: TncLine = nil); 111 | var 112 | SocketList: TSocketList; 113 | i: Integer; 114 | begin 115 | // Now inform all clients to update their user lists 116 | ConnectedUsersLock.Acquire; 117 | try 118 | SocketList := Server.Lines.LockList; 119 | try 120 | for i := 0 to SocketList.Count - 1 do 121 | if SocketList.Lines[i] <> aDontSendToLine then 122 | Server.ExecCommand(SocketList.Lines[i], cmdSrvUpdateLoggedInUsers, BytesOf(ConnectedUsers.CommaText), False); 123 | finally 124 | Server.Lines.UnlockList; 125 | end; 126 | finally 127 | ConnectedUsersLock.Release; 128 | end; 129 | end; 130 | 131 | function TfrmMain.ServerHandleCommand(Sender: TObject; aLine: TncLine; aCmd: Integer; const aData: TArray; aRequiresResult: Boolean; 132 | const aSenderComponent, aReceiverComponent: string): TArray; 133 | var 134 | UserData: TConnectedUserData; 135 | i, j: Integer; 136 | BytesStream: TBytesStream; 137 | DataToSend: TBytes; 138 | SocketList: TSocketList; 139 | begin 140 | SetLength(Result, 0); 141 | 142 | case aCmd of 143 | cmdCntUserLogin: 144 | begin 145 | // When the user logs in, he/she sends a name which is held in aData 146 | ConnectedUsersLock.Acquire; 147 | try 148 | // If a username already exists, the ConnectedUsers will raise an exception 149 | // as it has Duplicates set to dupError 150 | // This exception will travel back to the client. Since we want a custom 151 | // message, we trap the exception and change its message 152 | UserData := TConnectedUserData.Create; 153 | UserData.Line := aLine; 154 | UserData.Image := TBitmap.Create; 155 | try 156 | ConnectedUsers.AddObject(StringOf(aData), UserData); 157 | except 158 | UserData.Image.Free; 159 | UserData.Free; 160 | raise Exception.Create('Cannot login with this name, another user has already taken it'); 161 | end; 162 | finally 163 | ConnectedUsersLock.Release; 164 | end; 165 | 166 | // Inform all connected clients of the new data 167 | InformClientsOfLogins; 168 | end; 169 | cmdCntCameraImage: 170 | begin 171 | // The client is sending us a video image, update our list 172 | ConnectedUsersLock.Acquire; 173 | try 174 | for i := 0 to ConnectedUsers.Count - 1 do 175 | begin 176 | UserData := TConnectedUserData(ConnectedUsers.Objects[i]); 177 | if UserData.Line = aLine then 178 | begin 179 | BytesStream := TBytesStream.Create(aData); 180 | try 181 | UserData.Image.LoadFromStream(BytesStream); 182 | finally 183 | BytesStream.Free; 184 | end; 185 | 186 | // Send the image to everyone 187 | DataToSend := BytesOf(ConnectedUsers.Strings[i]) + BytesOf(#13#10) + aData; 188 | SocketList := Server.Lines.LockList; 189 | try 190 | for j := 0 to SocketList.Count - 1 do 191 | Server.ExecCommand(SocketList.Lines[j], cmdSrvUpdateImage, DataToSend, False); 192 | finally 193 | Server.Lines.UnlockList; 194 | end; 195 | 196 | Break; 197 | end; 198 | end; 199 | finally 200 | ConnectedUsersLock.Release; 201 | end; 202 | end; 203 | cmdCntGetText: 204 | begin 205 | // Send the text to all users 206 | SocketList := Server.Lines.LockList; 207 | try 208 | for j := 0 to SocketList.Count - 1 do 209 | Server.ExecCommand(SocketList.Lines[j], cmdSrvGetText, aData, False); 210 | finally 211 | Server.Lines.UnlockList; 212 | end; 213 | end; 214 | end; 215 | end; 216 | 217 | end. 218 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Bill Anastasios Demos 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /NetCom7.dpk: -------------------------------------------------------------------------------- 1 | package NetCom7; 2 | 3 | {$R *.res} 4 | {$R 'Source\NetComRegister.dcr'} 5 | {$R *.dres} 6 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} 7 | {$ALIGN 8} 8 | {$ASSERTIONS OFF} 9 | {$BOOLEVAL OFF} 10 | {$DEBUGINFO OFF} 11 | {$EXTENDEDSYNTAX ON} 12 | {$IMPORTEDDATA ON} 13 | {$IOCHECKS ON} 14 | {$LOCALSYMBOLS OFF} 15 | {$LONGSTRINGS ON} 16 | {$OPENSTRINGS ON} 17 | {$OPTIMIZATION ON} 18 | {$OVERFLOWCHECKS OFF} 19 | {$RANGECHECKS OFF} 20 | {$REFERENCEINFO OFF} 21 | {$SAFEDIVIDE OFF} 22 | {$STACKFRAMES OFF} 23 | {$TYPEDADDRESS OFF} 24 | {$VARSTRINGCHECKS OFF} 25 | {$WRITEABLECONST OFF} 26 | {$MINENUMSIZE 1} 27 | {$IMAGEBASE $400000} 28 | {$DEFINE RELEASE} 29 | {$ENDIF IMPLICITBUILDING} 30 | {$DESCRIPTION 'NetCom7 Network Communications Suite'} 31 | {$IMPLICITBUILD ON} 32 | 33 | requires 34 | rtl, 35 | DesignIDE, 36 | dbrtl, 37 | adortl; 38 | 39 | contains 40 | NetComRegister in 'Source\NetComRegister.pas', 41 | ncThreads in 'Source\ncThreads.pas', 42 | ncLines in 'Source\ncLines.pas', 43 | ncSocketList in 'Source\ncSocketList.pas', 44 | ncSockets in 'Source\ncSockets.pas', 45 | ncCommandPacking in 'Source\ncCommandPacking.pas', 46 | ncCommandHandlers in 'Source\ncCommandHandlers.pas', 47 | ncSources in 'Source\ncSources.pas', 48 | ncSerializeADO in 'Source\ncSerializeADO.pas', 49 | ncDBSrv in 'Source\ncDBSrv.pas', 50 | ncDBCnt in 'Source\ncDBCnt.pas', 51 | ncDBCommands in 'Source\ncDBCommands.pas', 52 | ncCompression in 'Source\ncCompression.pas', 53 | ncEncryption in 'Source\ncEncryption.pas', 54 | ncEncBlockciphers in 'Source\Encryption\ncEncBlockciphers.pas', 55 | ncEncBlowfish in 'Source\Encryption\ncEncBlowfish.pas', 56 | ncEncCast128 in 'Source\Encryption\ncEncCast128.pas', 57 | ncEncCast256 in 'Source\Encryption\ncEncCast256.pas', 58 | ncEncCrypt2 in 'Source\Encryption\ncEncCrypt2.pas', 59 | ncEncDes in 'Source\Encryption\ncEncDes.pas', 60 | ncEncHaval in 'Source\Encryption\ncEncHaval.pas', 61 | ncEncIce in 'Source\Encryption\ncEncIce.pas', 62 | ncEncIdea in 'Source\Encryption\ncEncIdea.pas', 63 | ncEncMars in 'Source\Encryption\ncEncMars.pas', 64 | ncEncMd4 in 'Source\Encryption\ncEncMd4.pas', 65 | ncEncMd5 in 'Source\Encryption\ncEncMd5.pas', 66 | ncEncMisty1 in 'Source\Encryption\ncEncMisty1.pas', 67 | ncEncRc2 in 'Source\Encryption\ncEncRc2.pas', 68 | ncEncRc4 in 'Source\Encryption\ncEncRc4.pas', 69 | ncEncRc5 in 'Source\Encryption\ncEncRc5.pas', 70 | ncEncRc6 in 'Source\Encryption\ncEncRc6.pas', 71 | ncEncRijndael in 'Source\Encryption\ncEncRijndael.pas', 72 | ncEncRipemd128 in 'Source\Encryption\ncEncRipemd128.pas', 73 | ncEncRipemd160 in 'Source\Encryption\ncEncRipemd160.pas', 74 | ncEncSerpent in 'Source\Encryption\ncEncSerpent.pas', 75 | ncEncSha1 in 'Source\Encryption\ncEncSha1.pas', 76 | ncEncSha256 in 'Source\Encryption\ncEncSha256.pas', 77 | ncEncSha512 in 'Source\Encryption\ncEncSha512.pas', 78 | ncEncTea in 'Source\Encryption\ncEncTea.pas', 79 | ncEncTiger in 'Source\Encryption\ncEncTiger.pas', 80 | ncEncTwofish in 'Source\Encryption\ncEncTwofish.pas', 81 | ncPendingCommandsList in 'Source\ncPendingCommandsList.pas', 82 | ncUDPSockets in 'Source\ncUDPSockets.pas', 83 | ncIPUtils in 'Source\ncIPUtils.pas'; 84 | 85 | end. 86 | 87 | -------------------------------------------------------------------------------- /NetCom7.dproj.local: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 2020/08/08 06:05:23.000.402,=C:\Users\Programmer\Documents\Development\Components\NetCom7\Source\ncSocketList.pas 8 | 2020/08/08 06:14:41.000.027,=C:\Users\Programmer\Documents\Development\Components\NetCom7\Unit1.pas 9 | 2020/08/08 06:15:03.000.683,C:\Users\Programmer\Documents\Development\Components\NetCom7\Unit1.pas=C:\Users\Programmer\Documents\Development\Components\NetCom7\Source\ncLine.pas 10 | 2020/08/08 07:50:30.000.380,C:\Users\Programmer\Documents\Development\Components\NetCom7\Source\ncLines.pas=C:\Users\Programmer\Documents\Development\Components\NetCom7\Source\ncLine.pas 11 | 2020/08/10 13:33:07.000.316,=C:\Users\Programmer\Documents\Development\Components\NetCom7\Icons\TncClientSource.png 12 | 2020/08/10 13:45:09.000.739,C:\Users\Programmer\Documents\Development\Components\NetCom7\Icons\TncClientSource.png= 13 | 2020/08/10 13:45:27.000.192,=C:\Users\Programmer\Documents\Development\Components\NetCom7\Icons\TncClientSource.png 14 | 2020/08/10 13:48:53.000.848,C:\Users\Programmer\Documents\Development\Components\NetCom7\Icons\TncClientSource.png= 15 | 2020/08/10 13:50:07.000.192,=C:\Users\Programmer\Documents\Development\Components\NetCom7\Icons\TncIcon.bmp 16 | 2020/08/10 14:10:53.000.681,=C:\Users\Programmer\Documents\Development\Components\NetCom7\PaletteIcons\TncIcon.bmp 17 | 2020/08/11 19:21:43.000.342,=C:\Users\Programmer\Documents\Development\Components\NetCom7\Source\ncPendingCommandsList.pas 18 | 2025/01/15 16:33:36.000.508,=D:\_Delphi\_Library\NetCom7\Unit1.pas 19 | 2025/01/15 16:35:56.000.977,=D:\_Delphi\_Library\NetCom7\Source\ncUDPSockets.pas 20 | 2025/01/15 20:33:31.000.011,=D:\_Delphi\_Library\NetCom7 - Copie\PaletteIcons\tncudpclient_32x32.bmp 21 | 2025/01/15 20:33:39.000.888,=D:\_Delphi\_Library\NetCom7 - Copie\PaletteIcons\tncudpserver_32x32.bmp 22 | 2025/01/15 21:36:54.000.533,=D:\_Delphi\_Library\NetCom7\PaletteIcons\tncudpserver_32x32.bmp 23 | 2025/01/15 21:36:59.000.040,=D:\_Delphi\_Library\NetCom7\PaletteIcons\tncudpclient_32x32.bmp 24 | 2025/01/15 21:38:09.000.173,D:\_Delphi\_Library\NetCom7\PaletteIcons\tncudpserver_32x32.bmp= 25 | 2025/01/15 21:38:44.000.282,D:\_Delphi\_Library\NetCom7\PaletteIcons\tncudpclient_32x32.bmp= 26 | 2025/01/16 20:01:26.000.332,=D:\_Delphi\_Library\NetCom7\PaletteIcons\tncudpclient.bmp 27 | 2025/01/16 20:01:26.000.367,=D:\_Delphi\_Library\NetCom7\PaletteIcons\tncudpserver.bmp 28 | 2025/01/21 00:15:32.000.432,=D:\_Delphi\_Library\Netcom7\Source\ncIPv6Utils.pas 29 | 2025/01/21 00:36:50.000.240,D:\_Delphi\_Library\Netcom7\Source\ncIPv6Utils.pas=D:\_Delphi\_Library\Netcom7\Source\ncIPUtils.pas 30 | 31 | 32 | -------------------------------------------------------------------------------- /NetCom7.dres: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/NetCom7.dres -------------------------------------------------------------------------------- /NetCom7.identcache: -------------------------------------------------------------------------------- 1 | -0D:\_Delphi\_Library\Netcom7\Source\ncIPUtils.pas=D:\_Delphi\_Library\Netcom7\Source\Encryption\ncEncMisty1.pas3D:\_Delphi\_Library\Netcom7\Source\ncDBCommands.pas>D:\_Delphi\_Library\Netcom7\Source\Encryption\ncEncCast256.pas7D:\_Delphi\_Library\Netcom7\Source\ncCommandPacking.pas>D:\_Delphi\_Library\Netcom7\Source\Encryption\ncEncTwofish.pas:D:\_Delphi\_Library\Netcom7\Source\Encryption\ncEncTea.pas:D:\_Delphi\_Library\Netcom7\Source\Encryption\ncEncMd5.pas:D:\_Delphi\_Library\Netcom7\Source\Encryption\ncEncMd4.pas3D:\_Delphi\_Library\Netcom7\Source\ncUDPSockets.pas:D:\_Delphi\_Library\Netcom7\Source\Encryption\ncEncRc5.pas.D:\_Delphi\_Library\Netcom7\Source\ncDBCnt.pas.D:\_Delphi\_Library\Netcom7\Source\ncDBSrv.pasD:\_Delphi\_Library\Netcom7\Source\Encryption\ncEncCast128.pas?D:\_Delphi\_Library\Netcom7\Source\Encryption\ncEncRijndael.pas>D:\_Delphi\_Library\Netcom7\Source\Encryption\ncEncSerpent.pas:D:\_Delphi\_Library\Netcom7\Source\Encryption\ncEncRc4.pas5D:\_Delphi\_Library\Netcom7\Source\NetComRegister.pas0D:\_Delphi\_Library\Netcom7\Source\ncSources.pas=D:\_Delphi\_Library\Netcom7\Source\Encryption\ncEncSha256.pas;D:\_Delphi\_Library\Netcom7\Source\Encryption\ncEncSha1.pas4D:\_Delphi\_Library\Netcom7\Source\ncCompression.pasCD:\_Delphi\_Library\Netcom7\Source\Encryption\ncEncBlockciphers.pas@D:\_Delphi\_Library\Netcom7\Source\Encryption\ncEncRipemd128.pas?D:\_Delphi\_Library\Netcom7\Source\Encryption\ncEncBlowfish.pas;D:\_Delphi\_Library\Netcom7\Source\Encryption\ncEncMars.pas@D:\_Delphi\_Library\Netcom7\Source\Encryption\ncEncRipemd160.pas 31 | 32 | This set of components is the fastest possible implementation of socket communications, in any language; this is an extremely optimised code on TCP/IP sockets. Forget using a thread per connection: With this suite you can have as many concurrent connections to your server as you like. Threads are used per request and not per connection, and are maintained in a very fast thread pool class. 33 | 34 | The implementation begins with TncTCPServer and TncTCPClient which implements the basic socket communications. 35 | You can use TncTCPClient and TncTCPServer if all you want is to implement standard (but very fast) socket comms. 36 | 37 | On top of the TCP/IP sockets, a lightweight protocol is implemented to be able to pack and unpack buffers (simple TCP/IP is streaming and has no notion of a well defined buffer). The set of components implementing this functionality is TncServerSource and TncClientSource. Both of these components implement an ExecCommand (aCmd, aData) which triggers an OnHandleCommand event on the other side (a client can ExecCommand to a server, or a server can ExecCommand to any client). ExecCommand can be blocking or non-blocking (async) depending on how you set its aRequiresResult parameter. If you use the blocking behaviour, the component still handles incoming requests from its peer(s). For example, a ClientSource could be waiting on an ExecCommand to the server, but while waiting it can serve ExecCommand requests from the server! 38 | 39 | Simple senario: 40 | Server: 41 | 42 | - You put a TncServerSource on your form. 43 | If you want you can change the port it is listening to via the 44 | Port property. 45 | 46 | - You implement an OnHandleCommand event handler and, 47 | depending on aCmd parameter (integer), you respond the result of 48 | the command via setting the Result of the OnHandleCommand to 49 | anything you like (TBytes). If an exception is raised while in 50 | HandleCommand, it is trapped, packed, transfered accross to the 51 | calling peer, and raised at the peer's issued ExecCommand. 52 | This way exceptions can be handled as if they were raised locally. 53 | 54 | - You set the Active property to true. Your server is ready. 55 | 56 | Client: 57 | 58 | - You put a TncClientSource on your form. 59 | You can set Host and Port to whatever you want. 60 | 61 | - You set Active property to true. 62 | Your client is now connected to the server. 63 | 64 | - You call ExecCommand (on your TncClientSource), with any 65 | command number and data that you like. This will send your 66 | command and data over to the server, call its OnHandleCommand, 67 | pack the response, and return it as a result to your ExecCommand. 68 | 69 | - ExecCommand is blocking (if aRequiresResult parameter is set to true), 70 | but only for the current command issued. 71 | The TncClientSource's OnHandleCommand still executes, so, 72 | while waiting for a command to return, your client socket may be 73 | processing requests from your server (a server can also 74 | ExecCommand to a client). 75 | 76 | - If you have forgotten to set Active to true and call ExecCommand, 77 | the TncClientSource will first try to connect, so you can ommit 78 | setting this property. It will also try to connect if it knows 79 | it has been disconnected (and the Reconnect property is set to true). 80 | 81 | This set of components promises unrivalled speed and that is not just in words: 82 | 83 | A simple timing test with the NetComVSIndy demo gives the following results: 84 | 85 | * Testing Indy... Time taken: 32468 msec 86 | * Testing NetCom... Time taken: 25109 msec 87 | 88 | Starting with the base unit, ncSockets.pas, you will see that the implementation does not suffer from slack code, it is rather immediate. The **inline** calling convention has been used wherever deemed appropriate. The very core functions have been tested and optimised by monitoring the performance via timing of large loops and assembly inspection to squeeze out every last bit of performance. 89 | 90 | The biggest difference though in speed gain is due to the architecture. Unlike most typical sockets: 91 | 92 | **this set of sockets does neither spawn nor use a thread per connection.** 93 | 94 | This means **you can have as many live connections as you like and you will see NO difference in performance!** A thread pool just waits for any requests; if a thread was to be created per request or per connection, the speed would suffer a lot, as creating a thread is quite heavy time-wise. If the number of requests per second cannot be handled by the thread pool, the thread pool grows up to a maximum defined size, and if it still cannot cope, the client just waits until the server gets a ready thread to process its request. 95 | 96 | Particular attention has been given to connection issues also. For example, the disconnects are picked up immediately, and if a line is so bad that the disconnect cannot be picked up, it tackles this by a keep alive packet by which it gets to know the actual status. There is a **Reconnect property** and a KeepAlive property. When a client gets disconnected, for whatever reason, it tries to reconnect transparently and without affecting the main application's performance. This way you do not have to worry about keeping your clients connected. 97 | 98 | Compression and encryption are also standard with these components with no extra libraries required. Ofcourse you can use your own compression or encryption if you prefer, but it is rather handy to have just a property you can set on the component. 99 | 100 | This set of components can also deal with garbage data thrown at them, they have been used and tested in huge, country-wide projects where all sorts of attacks can be seen. 101 | 102 | The effort a programmer has to make to use these components is minimal compared to other frameworks. Please refer to the demos for a better understanding on how to use these components. 103 | 104 | Written by Bill Anastasios Demos. 105 | Special thanks to Daniel Mauric, Tommi Prami, Roland Bengtsson for the extensive testing and suggestions. Thank you so much! 106 | 107 | VasDemos[at]yahoo[dot]co[dot]uk 108 | 109 | ** Delphi RULES ** 110 | -------------------------------------------------------------------------------- /Source/NetComRegister.dcr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/Source/NetComRegister.dcr -------------------------------------------------------------------------------- /Source/NetComRegister.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/Source/NetComRegister.pas -------------------------------------------------------------------------------- /Source/ncCommandHandlers.pas: -------------------------------------------------------------------------------- 1 | unit ncCommandHandlers; 2 | 3 | // To disable as much of RTTI as possible (Delphi 2009/2010), 4 | // Note: There is a bug if $RTTI is used before the "unit ;" section of a unit, hence the position 5 | {$IF CompilerVersion >= 21.0} 6 | {$WEAKLINKRTTI ON} 7 | {$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])} 8 | {$ENDIF} 9 | 10 | interface 11 | 12 | uses 13 | System.Classes, System.SysUtils, System.SyncObjs, System.Rtti, ncSources; 14 | 15 | type 16 | TncCustomCommandHandler = class(TComponent, IncCommandHandler) 17 | private 18 | FSource: TncSourceBase; 19 | FPeerCommandHandler: string; 20 | FOnConnected: TncOnSourceConnectDisconnect; 21 | FOnDisconnected: TncOnSourceConnectDisconnect; 22 | FOnHandleCommand: TncOnSourceHandleCommand; 23 | FOnAsyncExecCommandResult: TncOnAsyncExecCommandResult; 24 | procedure SetSource(const Value: TncSourceBase); 25 | function GetPeerCommandHandler: string; 26 | procedure SetPeerCommandHandler(const Value: string); 27 | function GetOnConnected: TncOnSourceConnectDisconnect; 28 | procedure SetOnConnected(const Value: TncOnSourceConnectDisconnect); 29 | function GetOnDisconnected: TncOnSourceConnectDisconnect; 30 | procedure SetOnDisconnected(const Value: TncOnSourceConnectDisconnect); 31 | function GetOnHandleCommand: TncOnSourceHandleCommand; 32 | procedure SetOnHandleCommand(const Value: TncOnSourceHandleCommand); 33 | function GetOnAsyncExecCommandResult: TncOnAsyncExecCommandResult; 34 | procedure SetOnAsyncExecCommandResult(const Value: TncOnAsyncExecCommandResult); 35 | protected 36 | procedure Notification(AComponent: TComponent; Operation: TOperation); override; 37 | function GetComponentName: string; 38 | 39 | property Source: TncSourceBase read FSource write SetSource; 40 | property PeerCommandHandler: string read GetPeerCommandHandler write SetPeerCommandHandler; 41 | property OnConnected: TncOnSourceConnectDisconnect read GetOnConnected write SetOnConnected; 42 | property OnDisconnected: TncOnSourceConnectDisconnect read GetOnDisconnected write SetOnDisconnected; 43 | property OnHandleCommand: TncOnSourceHandleCommand read GetOnHandleCommand write SetOnHandleCommand; 44 | property OnAsyncExecCommandResult: TncOnAsyncExecCommandResult read GetOnAsyncExecCommandResult write SetOnAsyncExecCommandResult; 45 | public 46 | constructor Create(AOwner: TComponent); override; 47 | destructor Destroy; override; 48 | 49 | function ExecCommand(aLine: TncSourceLine; const aCmd: Integer; const aData: TBytes = nil; const aRequiresResult: Boolean = True; 50 | aAsyncExecute: Boolean = False; const aPeerComponentHandler: string = ''): TBytes; 51 | published 52 | end; 53 | 54 | TncCommandHandler = class(TncCustomCommandHandler) 55 | published 56 | property Source; 57 | property PeerCommandHandler; 58 | 59 | property OnConnected; 60 | property OnDisconnected; 61 | property OnHandleCommand; 62 | end; 63 | 64 | implementation 65 | 66 | { TncCustomCommandHandler } 67 | 68 | constructor TncCustomCommandHandler.Create(AOwner: TComponent); 69 | begin 70 | inherited Create(AOwner); 71 | FSource := nil; 72 | FOnConnected := nil; 73 | FOnDisconnected := nil; 74 | FOnHandleCommand := nil; 75 | FOnAsyncExecCommandResult := nil; 76 | end; 77 | 78 | destructor TncCustomCommandHandler.Destroy; 79 | begin 80 | Source := nil; 81 | inherited Destroy; 82 | end; 83 | 84 | procedure TncCustomCommandHandler.Notification(AComponent: TComponent; Operation: TOperation); 85 | begin 86 | inherited Notification(AComponent, Operation); 87 | 88 | if Operation = opRemove then 89 | if AComponent = FSource then 90 | SetSource(nil); 91 | 92 | if not(csLoading in ComponentState) then 93 | begin 94 | if Operation = opInsert then 95 | if not Assigned(FSource) then 96 | if AComponent is TncSourceBase then 97 | SetSource(TncSourceBase(AComponent)); 98 | end; 99 | end; 100 | 101 | function TncCustomCommandHandler.ExecCommand(aLine: TncSourceLine; const aCmd: Integer; const aData: TBytes = nil; const aRequiresResult: Boolean = True; 102 | aAsyncExecute: Boolean = False; const aPeerComponentHandler: string = ''): TBytes; 103 | begin 104 | if not Assigned(Source) then 105 | raise Exception.Create('Cannot execute with no source object'); 106 | 107 | // If no override, we use the component's command handler (the property) 108 | if aPeerComponentHandler = '' then 109 | Result := Source.ExecCommand(aLine, aCmd, aData, aRequiresResult, aAsyncExecute, PeerCommandHandler) 110 | else 111 | Result := Source.ExecCommand(aLine, aCmd, aData, aRequiresResult, aAsyncExecute, aPeerComponentHandler); 112 | end; 113 | 114 | procedure TncCustomCommandHandler.SetSource(const Value: TncSourceBase); 115 | begin 116 | if FSource <> Value then 117 | begin 118 | if Assigned(FSource) then 119 | FSource.RemoveCommandHandler(Self); 120 | 121 | FSource := Value; 122 | 123 | if Assigned(FSource) then 124 | FSource.AddCommandHandler(Self); 125 | end; 126 | end; 127 | 128 | function TncCustomCommandHandler.GetPeerCommandHandler: string; 129 | begin 130 | Result := FPeerCommandHandler; 131 | end; 132 | 133 | procedure TncCustomCommandHandler.SetPeerCommandHandler(const Value: string); 134 | begin 135 | FPeerCommandHandler := Value; 136 | end; 137 | 138 | function TncCustomCommandHandler.GetComponentName: string; 139 | begin 140 | Result := Name; 141 | end; 142 | 143 | function TncCustomCommandHandler.GetOnConnected: TncOnSourceConnectDisconnect; 144 | begin 145 | Result := FOnConnected; 146 | end; 147 | 148 | procedure TncCustomCommandHandler.SetOnConnected(const Value: TncOnSourceConnectDisconnect); 149 | begin 150 | FOnConnected := Value; 151 | end; 152 | 153 | function TncCustomCommandHandler.GetOnDisconnected: TncOnSourceConnectDisconnect; 154 | begin 155 | Result := FOnDisconnected; 156 | end; 157 | 158 | procedure TncCustomCommandHandler.SetOnDisconnected(const Value: TncOnSourceConnectDisconnect); 159 | begin 160 | FOnDisconnected := Value; 161 | end; 162 | 163 | function TncCustomCommandHandler.GetOnHandleCommand: TncOnSourceHandleCommand; 164 | begin 165 | Result := FOnHandleCommand; 166 | end; 167 | 168 | procedure TncCustomCommandHandler.SetOnHandleCommand(const Value: TncOnSourceHandleCommand); 169 | begin 170 | FOnHandleCommand := Value; 171 | end; 172 | 173 | function TncCustomCommandHandler.GetOnAsyncExecCommandResult: TncOnAsyncExecCommandResult; 174 | begin 175 | Result := FOnAsyncExecCommandResult; 176 | end; 177 | 178 | procedure TncCustomCommandHandler.SetOnAsyncExecCommandResult(const Value: TncOnAsyncExecCommandResult); 179 | begin 180 | FOnAsyncExecCommandResult := Value; 181 | end; 182 | 183 | end. 184 | -------------------------------------------------------------------------------- /Source/ncCompression.pas: -------------------------------------------------------------------------------- 1 | unit ncCompression; 2 | 3 | // To disable as much of RTTI as possible (Delphi 2009/2010), 4 | // Note: There is a bug if $RTTI is used before the "unit ;" section of a unit, hence the position 5 | {$IF CompilerVersion >= 21.0} 6 | {$WEAKLINKRTTI ON} 7 | {$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])} 8 | {$ENDIF} 9 | 10 | interface 11 | 12 | uses System.ZLib, System.Classes, System.SysUtils; 13 | 14 | type 15 | TncCompressionLevel = TZCompressionLevel; 16 | 17 | function CompressBytes(const aBytes: TBytes; aCompressionLevel: TncCompressionLevel = zcDefault): TBytes; 18 | function DecompressBytes(const aBytes: TBytes): TBytes; 19 | 20 | implementation 21 | 22 | function CompressBytes(const aBytes: TBytes; aCompressionLevel: TncCompressionLevel = zcDefault): TBytes; 23 | begin 24 | if Length(aBytes) > 0 then 25 | ZCompress(aBytes, Result, aCompressionLevel) 26 | else 27 | SetLength(Result, 0); 28 | end; 29 | 30 | function DecompressBytes(const aBytes: TBytes): TBytes; 31 | begin 32 | if Length(aBytes) > 0 then 33 | ZDecompress(aBytes, Result, Length(aBytes) * 128) 34 | else 35 | SetLength(Result, 0); 36 | end; 37 | 38 | end. 39 | -------------------------------------------------------------------------------- /Source/ncDBCommands.pas: -------------------------------------------------------------------------------- 1 | unit ncDBCommands; 2 | 3 | interface 4 | 5 | uses Classes, SysUtils, DB, ADODB, ADOInt, ncCommandPacking, ncSources, ncSerializeADO; 6 | 7 | const 8 | ncDBOpenDataset = 0; // uses TDBDatasetData as param 9 | ncDBCloseDataset = 1; // uses no params 10 | ncDBUpdateDataset = 2; // uses TDBUpdateDatasetData as param 11 | ncDBExecDataset = 3; // uses TDBDatasetData as param 12 | 13 | type 14 | TDBDatasetData = class 15 | public 16 | SQL: string; 17 | Parameters: TBytes; 18 | 19 | constructor Create; 20 | destructor Destroy; override; 21 | 22 | function FromBytes(aBytes: TBytes): Integer; virtual; 23 | function ToBytes: TBytes; virtual; 24 | end; 25 | 26 | TDBUpdateDatasetData = class(TDBDatasetData) 27 | public 28 | RecordUpdates: _Recordset; 29 | 30 | constructor Create; 31 | destructor Destroy; override; 32 | 33 | function FromBytes(aBytes: TBytes): Integer; override; 34 | function ToBytes: TBytes; override; 35 | end; 36 | 37 | implementation 38 | 39 | { TDBOpenDatasetData } 40 | 41 | constructor TDBDatasetData.Create; 42 | begin 43 | inherited Create; 44 | SetLength(Parameters, 0); 45 | end; 46 | 47 | destructor TDBDatasetData.Destroy; 48 | begin 49 | inherited; 50 | end; 51 | 52 | function TDBDatasetData.FromBytes(aBytes: TBytes): Integer; 53 | begin 54 | Result := 0; 55 | 56 | SQL := ReadString(aBytes, Result); 57 | Parameters := ReadBytes(aBytes, Result); 58 | end; 59 | 60 | function TDBDatasetData.ToBytes: TBytes; 61 | var 62 | BufLen: Integer; 63 | begin 64 | // This is intended for the use of WriteMessageEmbeddedBufferLen 65 | SetLength(Result, 0); 66 | BufLen := 0; 67 | 68 | WriteString(SQL, Result, BufLen); 69 | WriteBytes(Parameters, Result, BufLen); 70 | end; 71 | 72 | { TDBUpdateDatasetData } 73 | 74 | constructor TDBUpdateDatasetData.Create; 75 | begin 76 | inherited Create; 77 | RecordUpdates := nil; 78 | end; 79 | 80 | destructor TDBUpdateDatasetData.Destroy; 81 | begin 82 | if Assigned(RecordUpdates) then 83 | RecordUpdates := nil; 84 | 85 | inherited; 86 | end; 87 | 88 | function TDBUpdateDatasetData.FromBytes(aBytes: TBytes): Integer; 89 | begin 90 | Result := inherited FromBytes(aBytes); 91 | 92 | RecordUpdates := BytesToRecordset(ReadBytes(aBytes, Result)); 93 | end; 94 | 95 | function TDBUpdateDatasetData.ToBytes: TBytes; 96 | var 97 | BufLen: Integer; 98 | begin 99 | Result := inherited ToBytes; 100 | BufLen := Length(Result); 101 | 102 | WriteBytes(RecordsetToBytes(RecordUpdates, pfADTG), Result, BufLen); 103 | end; 104 | 105 | end. 106 | -------------------------------------------------------------------------------- /Source/ncPendingCommandsList.pas: -------------------------------------------------------------------------------- 1 | unit ncPendingCommandsList; 2 | 3 | /// //////////////////////////////////////////////////////////////////////////// 4 | // 5 | // TPendingCommandsList 6 | // Written by Demos Bill, Tue 11/08/2020 7 | // 8 | // PendingCommandsList, the equivalent of TStringList 9 | // but for the type of TncCommandUniqueID 10 | // 11 | /// //////////////////////////////////////////////////////////////////////////// 12 | 13 | interface 14 | 15 | uses System.Classes, System.SysUtils, System.RTLConsts, System.SyncObjs, ncCommandPacking; 16 | 17 | type 18 | TPendingCommandItem = record 19 | FUniqueID: TncCommandUniqueID; 20 | FReceivedResultEvent: TLightweightEvent; 21 | FResult: TncCommand; 22 | end; 23 | 24 | PPendingCommandItem = ^TPendingCommandItem; 25 | 26 | TPendingCommandItemsList = array of TPendingCommandItem; 27 | PPendingCommandItemsList = ^TPendingCommandItemsList; 28 | 29 | TPendingCommandsList = class(TPersistent) 30 | private 31 | FList: TPendingCommandItemsList; 32 | FCount: Integer; 33 | FCapacity: Integer; 34 | function GetUniqueIDs(Index: Integer): TncCommandUniqueID; register; 35 | function GetReceivedResultEvents(Index: Integer): TLightweightEvent; register; 36 | procedure PutReceivedResultEvents(Index: Integer; aReceivedResultEvent: TLightweightEvent); 37 | function GetResults(Index: Integer): TncCommand; 38 | procedure PutResults(Index: Integer; const aResult: TncCommand); 39 | procedure SetCapacity(aNewCapacity: Integer); 40 | protected 41 | procedure Insert(aIndex: Integer; const aUniqueID: TncCommandUniqueID; aReceivedResultEvent: TLightweightEvent); 42 | procedure Grow; 43 | public 44 | destructor Destroy; override; 45 | 46 | function Add(const aUniqueID: TncCommandUniqueID; aReceivedResultEvent: TLightweightEvent): Integer; 47 | procedure Clear; 48 | procedure Delete(aIndex: Integer); register; 49 | function Find(const aUniqueID: TncCommandUniqueID; var aIndex: Integer): Boolean; register; 50 | function IndexOf(const aUniqueID: TncCommandUniqueID): Integer; register; 51 | 52 | property Count: Integer read FCount; 53 | property UniqueIDs[index: Integer]: TncCommandUniqueID read GetUniqueIDs; default; 54 | property ReceivedResultEvents[index: Integer]: TLightweightEvent read GetReceivedResultEvents write PutReceivedResultEvents; 55 | property Results[index: Integer]: TncCommand read GetResults write PutResults; 56 | end; 57 | 58 | implementation 59 | 60 | resourcestring 61 | SDuplicateUniqueID = 'Command unique ID list does not allow duplicates'; 62 | 63 | { TPendingCommandList } 64 | 65 | destructor TPendingCommandsList.Destroy; 66 | begin 67 | inherited Destroy; 68 | FCount := 0; 69 | SetCapacity(0); 70 | end; 71 | 72 | function TPendingCommandsList.Add(const aUniqueID: TncCommandUniqueID; aReceivedResultEvent: TLightweightEvent): Integer; 73 | begin 74 | if Find(aUniqueID, Result) then 75 | raise Exception.Create(SDuplicateUniqueID); 76 | Insert(Result, aUniqueID, aReceivedResultEvent); 77 | end; 78 | 79 | procedure TPendingCommandsList.Clear; 80 | begin 81 | if FCount <> 0 then 82 | begin 83 | FCount := 0; 84 | SetCapacity(0); 85 | end; 86 | end; 87 | 88 | procedure TPendingCommandsList.Delete(aIndex: Integer); 89 | begin 90 | if (aIndex < 0) or (aIndex >= FCount) then 91 | raise Exception.Create(Format(SListIndexError, [aIndex])); 92 | 93 | Dec(FCount); 94 | if aIndex < FCount then 95 | System.Move(FList[aIndex + 1], FList[aIndex], (FCount - aIndex) * SizeOf(TPendingCommandItem)); 96 | end; 97 | 98 | // Binary Searching 99 | 100 | function TPendingCommandsList.Find(const aUniqueID: TncCommandUniqueID; var aIndex: Integer): Boolean; 101 | var 102 | Low, High, Mid: Integer; 103 | begin 104 | Result := False; 105 | Low := 0; 106 | High := FCount - 1; 107 | while Low <= High do 108 | begin 109 | Mid := (Low + High) shr 1; 110 | if aUniqueID > FList[Mid].FUniqueID then 111 | Low := Mid + 1 112 | else 113 | begin 114 | High := Mid - 1; 115 | if aUniqueID = FList[Mid].FUniqueID then 116 | begin 117 | Result := True; 118 | Low := Mid; 119 | end; 120 | end; 121 | end; 122 | aIndex := Low; 123 | end; 124 | 125 | procedure TPendingCommandsList.Grow; 126 | var 127 | Delta: Integer; 128 | begin 129 | if FCapacity > 64 then 130 | Delta := FCapacity div 4 131 | else if FCapacity > 8 then 132 | Delta := 16 133 | else 134 | Delta := 4; 135 | SetCapacity(FCapacity + Delta); 136 | end; 137 | 138 | function TPendingCommandsList.IndexOf(const aUniqueID: TncCommandUniqueID): Integer; 139 | begin 140 | if not Find(aUniqueID, Result) then 141 | Result := -1; 142 | end; 143 | 144 | procedure TPendingCommandsList.Insert(aIndex: Integer; const aUniqueID: TncCommandUniqueID; aReceivedResultEvent: TLightweightEvent); 145 | begin 146 | if FCount = FCapacity then 147 | Grow; 148 | if aIndex < FCount then 149 | System.Move(FList[aIndex], FList[aIndex + 1], (FCount - aIndex) * SizeOf(TPendingCommandItem)); 150 | with FList[aIndex] do 151 | begin 152 | FUniqueID := aUniqueID; 153 | FReceivedResultEvent := aReceivedResultEvent; 154 | end; 155 | Inc(FCount); 156 | end; 157 | 158 | function TPendingCommandsList.GetUniqueIDs(Index: Integer): TncCommandUniqueID; 159 | begin 160 | if (index < 0) or (index >= FCount) then 161 | raise Exception.Create(Format(SListIndexError, [index])); 162 | Result := FList[index].FUniqueID; 163 | end; 164 | 165 | function TPendingCommandsList.GetReceivedResultEvents(Index: Integer): TLightweightEvent; 166 | begin 167 | if (index < 0) or (index >= FCount) then 168 | raise Exception.Create(Format(SListIndexError, [index])); 169 | Result := FList[index].FReceivedResultEvent; 170 | end; 171 | 172 | procedure TPendingCommandsList.PutReceivedResultEvents(Index: Integer; aReceivedResultEvent: TLightweightEvent); 173 | begin 174 | if (index < 0) or (index >= FCount) then 175 | raise Exception.Create(Format(SListIndexError, [index])); 176 | FList[index].FReceivedResultEvent := aReceivedResultEvent; 177 | end; 178 | 179 | function TPendingCommandsList.GetResults(Index: Integer): TncCommand; 180 | begin 181 | if (index < 0) or (index >= FCount) then 182 | raise Exception.Create(Format(SListIndexError, [index])); 183 | Result := FList[index].FResult; 184 | end; 185 | 186 | procedure TPendingCommandsList.PutResults(Index: Integer; const aResult: TncCommand); 187 | begin 188 | if (index < 0) or (index >= FCount) then 189 | raise Exception.Create(Format(SListIndexError, [index])); 190 | FList[index].FResult := aResult; 191 | end; 192 | 193 | procedure TPendingCommandsList.SetCapacity(aNewCapacity: Integer); 194 | begin 195 | if aNewCapacity < FCount then 196 | raise Exception.Create(Format(SListCapacityError, [aNewCapacity])); 197 | if aNewCapacity <> FCapacity then 198 | begin 199 | SetLength(FList, aNewCapacity); 200 | FCapacity := aNewCapacity; 201 | end; 202 | end; 203 | 204 | end. 205 | -------------------------------------------------------------------------------- /Source/ncSerializeValue.pas: -------------------------------------------------------------------------------- 1 | unit ncSerializeValue; 2 | 3 | interface 4 | 5 | uses Rtti; 6 | 7 | implementation 8 | var 9 | RttiContext: TRttiContext; 10 | 11 | { Value ToBytes: 12 | if Data.IsEmpty then 13 | WriteString('nil') 14 | else 15 | begin 16 | // Write Data (TncValue) string name 17 | 18 | WriteString(RttiContext.GetType(Data.TypeInfo).QualifiedName); 19 | 20 | // Append Data (TncValue) contents 21 | Len := Length(Result); 22 | SetLength(Result, Len + Data.DataSize); 23 | Data.ExtractRawData(@Result[Len]); 24 | end; 25 | 26 | Value FromBytes: 27 | // Read Data (TncValue) string name 28 | TypeName := ReadString; 29 | 30 | // Read Data (TncValue) contents 31 | if TypeName = 'nil' then 32 | Data := nil 33 | else 34 | TValue.Make(@aBytes[Ofs], RttiContext.FindType(TypeName).Handle, Data); 35 | 36 | } 37 | 38 | initialization 39 | 40 | RttiContext := TRttiContext.Create; 41 | 42 | finalization 43 | 44 | RttiContext.Free; 45 | 46 | end. 47 | -------------------------------------------------------------------------------- /Source/ncSocketList.pas: -------------------------------------------------------------------------------- 1 | unit ncSocketList; 2 | 3 | /// //////////////////////////////////////////////////////////////////////////// 4 | // 5 | // TSocketList 6 | // Written by Demos Bill, Tue 21/10/2004 7 | // 8 | // SocketList, the equivalent of TStringList 9 | // but for the type of TSocket handles 10 | // 11 | /// //////////////////////////////////////////////////////////////////////////// 12 | 13 | interface 14 | 15 | uses System.Classes, System.SysUtils, System.RTLConsts, ncLines; 16 | 17 | type 18 | TSocketItem = record 19 | FSocketHandle: TSocketHandle; 20 | FLine: TncLine; 21 | end; 22 | 23 | PSocketItem = ^TSocketItem; 24 | 25 | TSocketItemList = array of TSocketItem; 26 | PSocketItemList = ^TSocketItemList; 27 | 28 | TSocketList = class(TPersistent) 29 | private 30 | FList: TSocketItemList; 31 | FCount: Integer; 32 | FCapacity: Integer; 33 | function GetSocketHandles(Index: Integer): TSocketHandle; register; 34 | function GetLines(Index: Integer): TncLine; register; 35 | procedure PutLines(Index: Integer; aLine: TncLine); 36 | procedure SetCapacity(aNewCapacity: Integer); 37 | protected 38 | procedure AssignTo(Dest: TPersistent); override; 39 | procedure Insert(aIndex: Integer; const aSocketHandle: TSocketHandle; aLine: TncLine); 40 | procedure Grow; 41 | public 42 | destructor Destroy; override; 43 | 44 | function Add(const aSocketHandle: TSocketHandle; aLine: TncLine): Integer; 45 | procedure Clear; 46 | procedure Delete(aIndex: Integer); register; 47 | function Find(const aSocketHandle: TSocketHandle; var aIndex: Integer): Boolean; register; 48 | function IndexOf(const aSocketHandle: TSocketHandle): Integer; register; 49 | 50 | property Count: Integer read FCount; 51 | property SocketHandles[index: Integer]: TSocketHandle read GetSocketHandles; default; 52 | property Lines[index: Integer]: TncLine read GetLines write PutLines; 53 | end; 54 | 55 | implementation 56 | 57 | resourcestring 58 | SDuplicateSocketHandle = 'Socket handle list does not allow duplicates'; 59 | 60 | { TSocketList } 61 | 62 | destructor TSocketList.Destroy; 63 | begin 64 | inherited Destroy; 65 | FCount := 0; 66 | SetCapacity(0); 67 | end; 68 | 69 | procedure TSocketList.AssignTo(Dest: TPersistent); 70 | var 71 | DestList: TSocketList; 72 | begin 73 | if Dest is TSocketList then 74 | begin 75 | DestList := TSocketList(Dest); 76 | DestList.FCapacity := FCapacity; 77 | DestList.FCount := FCount; 78 | DestList.FList := Copy(FList); 79 | end 80 | else 81 | raise EConvertError.CreateResFmt(@SAssignError, [ClassName, Dest.ClassName]); 82 | end; 83 | 84 | function TSocketList.Add(const aSocketHandle: TSocketHandle; aLine: TncLine): Integer; 85 | begin 86 | if Find(aSocketHandle, Result) then 87 | raise Exception.Create(SDuplicateSocketHandle); 88 | Insert(Result, aSocketHandle, aLine); 89 | end; 90 | 91 | procedure TSocketList.Clear; 92 | begin 93 | if FCount <> 0 then 94 | begin 95 | FCount := 0; 96 | SetCapacity(0); 97 | end; 98 | end; 99 | 100 | procedure TSocketList.Delete(aIndex: Integer); 101 | begin 102 | if (aIndex < 0) or (aIndex >= FCount) then 103 | raise Exception.Create(Format(SListIndexError, [aIndex])); 104 | 105 | Dec(FCount); 106 | if aIndex < FCount then 107 | System.Move(FList[aIndex + 1], FList[aIndex], (FCount - aIndex) * SizeOf(TSocketItem)); 108 | end; 109 | 110 | // Binary Searching 111 | 112 | function TSocketList.Find(const aSocketHandle: TSocketHandle; var aIndex: Integer): Boolean; 113 | var 114 | Low, High, Mid: Integer; 115 | begin 116 | Result := False; 117 | Low := 0; 118 | High := FCount - 1; 119 | while Low <= High do 120 | begin 121 | Mid := (Low + High) shr 1; 122 | if aSocketHandle > FList[Mid].FSocketHandle then 123 | Low := Mid + 1 124 | else 125 | begin 126 | High := Mid - 1; 127 | if aSocketHandle = FList[Mid].FSocketHandle then 128 | begin 129 | Result := True; 130 | Low := Mid; 131 | end; 132 | end; 133 | end; 134 | aIndex := Low; 135 | end; 136 | 137 | procedure TSocketList.Grow; 138 | var 139 | Delta: Integer; 140 | begin 141 | if FCapacity > 64 then 142 | Delta := FCapacity div 4 143 | else if FCapacity > 8 then 144 | Delta := 16 145 | else 146 | Delta := 4; 147 | SetCapacity(FCapacity + Delta); 148 | end; 149 | 150 | function TSocketList.IndexOf(const aSocketHandle: TSocketHandle): Integer; 151 | begin 152 | if not Find(aSocketHandle, Result) then 153 | Result := -1; 154 | end; 155 | 156 | procedure TSocketList.Insert(aIndex: Integer; const aSocketHandle: TSocketHandle; aLine: TncLine); 157 | begin 158 | if FCount = FCapacity then 159 | Grow; 160 | if aIndex < FCount then 161 | System.Move(FList[aIndex], FList[aIndex + 1], (FCount - aIndex) * SizeOf(TSocketItem)); 162 | with FList[aIndex] do 163 | begin 164 | FSocketHandle := aSocketHandle; 165 | FLine := aLine; 166 | end; 167 | Inc(FCount); 168 | end; 169 | 170 | function TSocketList.GetSocketHandles(Index: Integer): TSocketHandle; 171 | begin 172 | if (index < 0) or (index >= FCount) then 173 | raise Exception.Create(Format(SListIndexError, [index])); 174 | Result := FList[index].FSocketHandle; 175 | end; 176 | 177 | function TSocketList.GetLines(Index: Integer): TncLine; 178 | begin 179 | if (index < 0) or (index >= FCount) then 180 | raise Exception.Create(Format(SListIndexError, [index])); 181 | Result := FList[index].FLine; 182 | end; 183 | 184 | procedure TSocketList.PutLines(Index: Integer; aLine: TncLine); 185 | begin 186 | if (index < 0) or (index >= FCount) then 187 | raise Exception.Create(Format(SListIndexError, [index])); 188 | FList[index].FLine := aLine; 189 | end; 190 | 191 | procedure TSocketList.SetCapacity(aNewCapacity: Integer); 192 | begin 193 | if aNewCapacity < FCount then 194 | raise Exception.Create(Format(SListCapacityError, [aNewCapacity])); 195 | if aNewCapacity <> FCapacity then 196 | begin 197 | SetLength(FList, aNewCapacity); 198 | FCapacity := aNewCapacity; 199 | end; 200 | end; 201 | 202 | end. 203 | -------------------------------------------------------------------------------- /image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/image-1.png -------------------------------------------------------------------------------- /image-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spawn451/NetCom7/1d5e0228d2a83e98f2442a42a87a58cb59e89af0/image-2.png --------------------------------------------------------------------------------