delphibuilder / netcom7 Goto Github PK
View Code? Open in Web Editor NEWThe fastest communications possible. Delphi rulez.
License: MIT License
The fastest communications possible. Delphi rulez.
License: MIT License
Trying out this library, thanks for your contribution to the Delphi community!
1, I disabled {$WARN COMBINING_SIGNED_UNSIGNED64 OFF}
2, Pass Self
to InitializeMasterFields
calls in ncDBCnt.pas
Hi,
I'm having a lot of issues with the Indy server components that come with Delphi 10.4 so I want to try your NetCom7 component.
What's the correct installation of this component in Delphi 10.4?
///////////////////////////////////////////////
//commands:
///////////////////////////////////////////////
const
cmdUserLogin = 0;
cmdFileName = 1;
cmdFileSize = 2;
cmdFileStream = 3;
///////////////////////////////////////////////
//on client side:
///////////////////////////////////////////////
procedure TForm1.Button1Click(Sender: TObject);
var
BS: TBytesStream;
begin
Client.ExecCommand(cmdFileName, BytesOf('client.png'));//send filename
BS := TBytesStream.Create();
BS.LoadFromFile('client.png');
// send client's filesize
Client.ExecCommand(cmdFileSize, BytesOf(BS.Size.ToString));
// send file
Client.ExecCommand(cmdFileStream, BS.Bytes); //in this line, BS.Bytes is correct file size
BS.Free;
end;
///////////////////////////////////////////////
//on server side:
///////////////////////////////////////////////
function TForm1.ServerHandleCommand(Sender: TObject; aLine: TncLine;
aCmd: Integer; const aData: TArray<System.Byte>; aRequiresResult: Boolean;
const aSenderComponent, aReceiverComponent: string): TArray<System.Byte>;
var
BS: TBytesStream;
begin
SetLength(Result, 0);
case aCmd of
cmdUserLogin:
begin
end;
cmdFileName:
begin
Memo1.Lines.Add(stringOf(aData));
end;
cmdFileStream:
begin
try
BS := TBytesStream.Create(aData);
BS.SaveToFile('_srv_test.png');
Memo1.Lines.Add('received file's size:' + Length(BS.Bytes).ToString);//<---Wrong file size
BS.Free;
finally
end;
end;
cmdFileSize:
begin
Memo1.Lines.Add(stringOf(aData));//correct file size
end;
end;
end;
///////////////////////////////////////////////
code write with delphi10.4.2 + FMX
solved
The hardware on which will run server App used some TncServer component may contain more that single network interface or adapter with different IP-addresses. How to bind the TncServer component to certain IP-address to listen corresponds network interface or adapter?
At be continue the issue โRestrict server IP addressโ.
Few coding conventions, few small optimisations (inlined method too late in unit) etc.
Take or leave it :)
[FixInsight Warning] NetComRegister.pas(51): W521 Return value of function 'GetVersion' might be undefined
[FixInsight Convention] ncThreads.pas(61): C107 Class field name 'ThreadClass' should start with 'F'
[FixInsight Convention] ncThreads.pas(64): C107 Class field name 'Threads' should start with 'F'
[FixInsight Warning] ncThreads.pas(125): W501 Empty EXCEPT block
[FixInsight Warning] ncThreads.pas(233): W501 Empty EXCEPT block
[FixInsight Warning] ncThreads.pas(239): W501 Empty EXCEPT block
[FixInsight Warning] ncThreads.pas(264): W501 Empty EXCEPT block
[FixInsight Warning] ncThreads.pas(276): W501 Empty EXCEPT block
[FixInsight Warning] ncThreads.pas(283): W501 Empty EXCEPT block
[FixInsight Warning] ncThreads.pas(171): W521 Return value of function 'TncThreadPool.RequestReadyThread' might be undefined
[FixInsight Optimization] ncThreads.pas(249): O805 Inline marked routine 'FromNCThreadPriority' comes after its call in the same unit
[FixInsight Optimization] ncThreads.pas(252): O805 Inline marked routine 'FromNCThreadPriority' comes after its call in the same unit
[FixInsight Optimization] ncThreads.pas(261): O805 Inline marked routine 'FromNCThreadPriority' comes after its call in the same unit
[FixInsight Convention] ncLines.pas(83): C107 Class field name 'PropertyLock' should start with 'F'
[FixInsight Convention] ncLines.pas(63): C111 Exception class name 'TncLineException' should start with 'E'
[FixInsight Warning] ncLines.pas(430): W501 Empty EXCEPT block
[FixInsight Warning] ncLines.pas(434): W501 Empty EXCEPT block
[FixInsight Warning] ncLines.pas(563): W501 Empty EXCEPT block
[FixInsight Warning] ncLines.pas(577): W501 Empty EXCEPT block
[FixInsight Optimization] ncLines.pas(290): O805 Inline marked routine 'TncLine.DestroyHandle' comes after its call in the same unit
[FixInsight Optimization] ncLines.pas(352): O805 Inline marked routine 'TncLine.DestroyHandle' comes after its call in the same unit
[FixInsight Optimization] ncLines.pas(405): O805 Inline marked routine 'TncLine.DestroyHandle' comes after its call in the same unit
[FixInsight Convention] ncSocketList.pas(52): C110 Getter or setter name is different from property declaration
[FixInsight Optimization] ncSocketList.pas(107): O805 Inline marked routine 'TSocketList.CompareSockets' comes after its call in the same unit
[FixInsight Convention] ncSockets.pas(125): C107 Class field name 'PropertyLock' should start with 'F'
[FixInsight Convention] ncSockets.pas(126): C107 Class field name 'ReadBuf' should start with 'F'
[FixInsight Convention] ncSockets.pas(165): C107 Class field name 'ReadSocketHandles' should start with 'F'
[FixInsight Convention] ncSockets.pas(166): C107 Class field name 'WasConnected' should start with 'F'
[FixInsight Convention] ncSockets.pas(167): C107 Class field name 'LastConnectAttempt' should start with 'F'
[FixInsight Convention] ncSockets.pas(222): C107 Class field name 'Listener' should start with 'F'
[FixInsight Convention] ncSockets.pas(223): C107 Class field name 'ReadSocketHandles' should start with 'F'
[FixInsight Convention] ncSockets.pas(224): C107 Class field name 'LinesToShutDown' should start with 'F'
[FixInsight Convention] ncSockets.pas(258): C107 Class field name 'ReadySockets' should start with 'F'
[FixInsight Warning] ncSockets.pas(439): W501 Empty EXCEPT block
[FixInsight Warning] ncSockets.pas(544): W501 Empty EXCEPT block
[FixInsight Warning] ncSockets.pas(585): W501 Empty EXCEPT block
[FixInsight Warning] ncSockets.pas(591): W501 Empty EXCEPT block
[FixInsight Warning] ncSockets.pas(597): W501 Empty EXCEPT block
[FixInsight Warning] ncSockets.pas(612): W501 Empty EXCEPT block
[FixInsight Warning] ncSockets.pas(744): W501 Empty EXCEPT block
[FixInsight Warning] ncSockets.pas(816): W501 Empty EXCEPT block
[FixInsight Warning] ncSockets.pas(837): W501 Empty EXCEPT block
[FixInsight Warning] ncSockets.pas(881): W501 Empty EXCEPT block
[FixInsight Warning] ncSockets.pas(928): W501 Empty EXCEPT block
[FixInsight Warning] ncSockets.pas(934): W501 Empty EXCEPT block
[FixInsight Warning] ncSockets.pas(940): W501 Empty EXCEPT block
[FixInsight Warning] ncSockets.pas(962): W501 Empty EXCEPT block
[FixInsight Warning] ncSockets.pas(1054): W501 Empty EXCEPT block
[FixInsight Warning] ncSockets.pas(1147): W501 Empty EXCEPT block
[FixInsight Warning] ncSockets.pas(1167): W501 Empty EXCEPT block
[FixInsight Warning] ncSockets.pas(1185): W501 Empty EXCEPT block
[FixInsight Warning] ncSockets.pas(1193): W501 Empty EXCEPT block
[FixInsight Convention] ncSources.pas(102): C107 Class field name 'MessageData' should start with 'F'
[FixInsight Convention] ncSources.pas(102): C107 Class field name 'HeaderBytes' should start with 'F'
[FixInsight Convention] ncSources.pas(103): C107 Class field name 'BytesToEndOfMessage' should start with 'F'
[FixInsight Convention] ncSources.pas(221): C107 Class field name 'WasSetActive' should start with 'F'
[FixInsight Convention] ncSources.pas(223): C107 Class field name 'PropertyLock' should start with 'F'
[FixInsight Convention] ncSources.pas(224): C107 Class field name 'CommandHandlers' should start with 'F'
[FixInsight Convention] ncSources.pas(225): C107 Class field name 'UniqueSentID' should start with 'F'
[FixInsight Convention] ncSources.pas(226): C107 Class field name 'HandleCommandThreadPool' should start with 'F'
[FixInsight Convention] ncSources.pas(227): C107 Class field name 'Socket' should start with 'F'
[FixInsight Convention] ncSources.pas(229): C107 Class field name 'PendingCommandsList' should start with 'F'
[FixInsight Convention] ncSources.pas(262): C110 Getter or setter name is different from property declaration
[FixInsight Convention] ncSources.pas(262): C110 Getter or setter name is different from property declaration
[FixInsight Warning] ncSources.pas(465): W501 Empty EXCEPT block
[FixInsight Warning] ncSources.pas(472): W501 Empty EXCEPT block
[FixInsight Warning] ncSources.pas(483): W501 Empty EXCEPT block
[FixInsight Warning] ncSources.pas(490): W501 Empty EXCEPT block
[FixInsight Warning] ncSources.pas(675): W501 Empty EXCEPT block
[FixInsight Optimization] ncSources.pas(669): O805 Inline marked routine 'TncSourceBase.HandleReceivedCommand' comes after its call in the same unit
[FixInsight Warning] ncSerializeADO.pas(228): W521 Return value of function 'BytesToVariant' might be undefined
[FixInsight Convention] ncDBSrv.pas(39): C107 Class field name 'ReadyResults' should start with 'F'
[FixInsight Convention] ncDBSrv.pas(41): C107 Class field name 'Tables' should start with 'F'
[FixInsight Convention] ncDBSrv.pas(55): C107 Class field name 'Serialiser' should start with 'F'
[FixInsight Convention] ncDBSrv.pas(58): C107 Class field name 'ReadyQueries' should start with 'F'
[FixInsight Convention] ncDBSrv.pas(71): C107 Class field name 'PropertyLock' should start with 'F'
[FixInsight Convention] ncDBSrv.pas(72): C107 Class field name 'ReadyQueryList' should start with 'F'
[FixInsight Convention] ncDBSrv.pas(81): C107 Class field name 'PrevADOConnectionString' should start with 'F'
[FixInsight Warning] ncDBSrv.pas(129): W519 Method 'TncDBServer.DBServerDisconnected' is empty
[FixInsight Warning] ncDBSrv.pas(134): W521 Return value of function 'TncDBServer.DBServerHandleCommand' might be undefined
[FixInsight Optimization] ncDBSrv.pas(307): O801 CONST missing for unmodified string parameter 'aConnectionString'
[FixInsight Optimization] ncDBSrv.pas(307): O801 CONST missing for unmodified string parameter 'aSQL'
[FixInsight Optimization] ncDBSrv.pas(468): O801 CONST missing for unmodified string parameter 'aSQL'
[FixInsight Optimization] ncDBSrv.pas(487): O801 CONST missing for unmodified string parameter 'aConnectionString'
[FixInsight Convention] ncDBCnt.pas(19): C107 Class field name 'WasActivated' should start with 'F'
[FixInsight Convention] ncDBCnt.pas(26): C107 Class field name 'BeforeUpdatesRecordIndex' should start with 'F'
[FixInsight Convention] ncDBCnt.pas(43): C107 Class field name 'WithinUpdates' should start with 'F'
[FixInsight Warning] ncDBCnt.pas(138): W519 Method 'TncDBDataset.GetOnConnected' is empty
[FixInsight Warning] ncDBCnt.pas(143): W519 Method 'TncDBDataset.SetOnConnected' is empty
[FixInsight Warning] ncDBCnt.pas(148): W519 Method 'TncDBDataset.GetOnDisconnected' is empty
[FixInsight Warning] ncDBCnt.pas(153): W519 Method 'TncDBDataset.SetOnDisconnected' is empty
[FixInsight Warning] ncDBCnt.pas(158): W519 Method 'TncDBDataset.GetOnHandleCommand' is empty
[FixInsight Warning] ncDBCnt.pas(163): W519 Method 'TncDBDataset.SetOnHandleCommand' is empty
[FixInsight Warning] ncDBCnt.pas(168): W519 Method 'TncDBDataset.GetOnAsyncExecCommandResult' is empty
[FixInsight Warning] ncDBCnt.pas(173): W519 Method 'TncDBDataset.SetOnAsyncExecCommandResult' is empty
[FixInsight Warning] ncDBCnt.pas(137): W521 Return value of function 'TncDBDataset.GetOnConnected' might be undefined
[FixInsight Warning] ncDBCnt.pas(147): W521 Return value of function 'TncDBDataset.GetOnDisconnected' might be undefined
[FixInsight Warning] ncDBCnt.pas(157): W521 Return value of function 'TncDBDataset.GetOnHandleCommand' might be undefined
[FixInsight Warning] ncDBCnt.pas(167): W521 Return value of function 'TncDBDataset.GetOnAsyncExecCommandResult' might be undefined
[FixInsight Warning] ncEncryption.pas(162): W521 Return value of function 'GetHash' might be undefined
[FixInsight Warning] ncEncryption.pas(68): W528 Variable 'i' not used in FOR-loop
[FixInsight Warning] ncEncryption.pas(115): W528 Variable 'i' not used in FOR-loop
[FixInsight Warning] ncEncryption.pas(169): W535 Enumerated constant(s) missing in case statement: 'htNoDigesting'
[FixInsight Warning] ncEncryption.pas(234): W535 Enumerated constant(s) missing in case statement: 'etNoEncryption'
[FixInsight Warning] ncEncryption.pas(302): W535 Enumerated constant(s) missing in case statement: 'etNoEncryption'
[FixInsight Optimization] ncEncryption.pas(212): O801 CONST missing for unmodified string parameter 'aFileName'
[FixInsight Optimization] ncEncryption.pas(228): O801 CONST missing for unmodified string parameter 'aEncryptionKey'
[FixInsight Optimization] ncEncryption.pas(296): O801 CONST missing for unmodified string parameter 'aDecryptionKey'
[FixInsight Convention] ncEncBlockciphers.pas(20): C107 Class field name 'IV' should start with 'F'
[FixInsight Convention] ncEncBlockciphers.pas(20): C107 Class field name 'CV' should start with 'F'
[FixInsight Convention] ncEncBlockciphers.pas(65): C107 Class field name 'IV' should start with 'F'
[FixInsight Convention] ncEncBlockciphers.pas(65): C107 Class field name 'CV' should start with 'F'
[FixInsight Warning] ncEncBlockciphers.pas(183): W528 Variable 'i' not used in FOR-loop
[FixInsight Warning] ncEncBlockciphers.pas(210): W528 Variable 'i' not used in FOR-loop
[FixInsight Warning] ncEncBlockciphers.pas(238): W528 Variable 'i' not used in FOR-loop
[FixInsight Warning] ncEncBlockciphers.pas(260): W528 Variable 'i' not used in FOR-loop
[FixInsight Warning] ncEncBlockciphers.pas(281): W528 Variable 'i' not used in FOR-loop
[FixInsight Warning] ncEncBlockciphers.pas(308): W528 Variable 'i' not used in FOR-loop
[FixInsight Warning] ncEncBlockciphers.pas(335): W528 Variable 'i' not used in FOR-loop
[FixInsight Warning] ncEncBlockciphers.pas(360): W528 Variable 'i' not used in FOR-loop
[FixInsight Warning] ncEncBlockciphers.pas(386): W528 Variable 'i' not used in FOR-loop
[FixInsight Warning] ncEncBlockciphers.pas(414): W528 Variable 'i' not used in FOR-loop
[FixInsight Warning] ncEncBlockciphers.pas(508): W528 Variable 'i' not used in FOR-loop
[FixInsight Warning] ncEncBlockciphers.pas(535): W528 Variable 'i' not used in FOR-loop
[FixInsight Warning] ncEncBlockciphers.pas(563): W528 Variable 'i' not used in FOR-loop
[FixInsight Warning] ncEncBlockciphers.pas(585): W528 Variable 'i' not used in FOR-loop
[FixInsight Warning] ncEncBlockciphers.pas(606): W528 Variable 'i' not used in FOR-loop
[FixInsight Warning] ncEncBlockciphers.pas(633): W528 Variable 'i' not used in FOR-loop
[FixInsight Warning] ncEncBlockciphers.pas(660): W528 Variable 'i' not used in FOR-loop
[FixInsight Warning] ncEncBlockciphers.pas(685): W528 Variable 'i' not used in FOR-loop
[FixInsight Warning] ncEncBlockciphers.pas(711): W528 Variable 'i' not used in FOR-loop
[FixInsight Warning] ncEncBlockciphers.pas(739): W528 Variable 'i' not used in FOR-loop
[FixInsight Convention] ncEncBlowfish.pas(20): C107 Class field name 'SBox' should start with 'F'
[FixInsight Convention] ncEncBlowfish.pas(21): C107 Class field name 'PBox' should start with 'F'
[FixInsight Convention] ncEncCast128.pas(20): C107 Class field name 'KeyData' should start with 'F'
[FixInsight Convention] ncEncCast128.pas(21): C107 Class field name 'Rounds' should start with 'F'
[FixInsight Convention] ncEncCast256.pas(20): C107 Class field name 'Kr' should start with 'F'
[FixInsight Convention] ncEncCast256.pas(20): C107 Class field name 'Km' should start with 'F'
[FixInsight Convention] ncEncCrypt2.pas(70): C110 Getter or setter name is different from property declaration
[FixInsight Convention] ncEncCrypt2.pas(71): C110 Getter or setter name is different from property declaration
[FixInsight Convention] ncEncCrypt2.pas(119): C110 Getter or setter name is different from property declaration
[FixInsight Convention] ncEncCrypt2.pas(120): C110 Getter or setter name is different from property declaration
[FixInsight Convention] ncEncCrypt2.pas(179): C110 Getter or setter name is different from property declaration
[FixInsight Warning] ncEncCrypt2.pas(201): W528 Variable 'i' not used in FOR-loop
[FixInsight Warning] ncEncCrypt2.pas(276): W528 Variable 'i' not used in FOR-loop
[FixInsight Warning] ncEncCrypt2.pas(298): W528 Variable 'i' not used in FOR-loop
[FixInsight Optimization] ncEncCrypt2.pas(230): O804 Method parameter 'Key' is declared but never used
[FixInsight Optimization] ncEncCrypt2.pas(230): O804 Method parameter 'InitVector' is declared but never used
[FixInsight Convention] ncEncDes.pas(28): C107 Class field name 'KeyData' should start with 'F'
[FixInsight Convention] ncEncDes.pas(41): C107 Class field name 'KeyData' should start with 'F'
[FixInsight Convention] ncEncHaval.pas(20): C107 Class field name 'LenHi' should start with 'F'
[FixInsight Convention] ncEncHaval.pas(20): C107 Class field name 'LenLo' should start with 'F'
[FixInsight Convention] ncEncHaval.pas(21): C107 Class field name 'Index' should start with 'F'
[FixInsight Convention] ncEncHaval.pas(22): C107 Class field name 'CurrentHash' should start with 'F'
[FixInsight Convention] ncEncHaval.pas(23): C107 Class field name 'HashBuffer' should start with 'F'
[FixInsight Convention] ncEncIce.pas(20): C107 Class field name 'rounds' should start with 'F'
[FixInsight Convention] ncEncIce.pas(21): C107 Class field name 'ik_keysched' should start with 'F'
[FixInsight Convention] ncEncIdea.pas(20): C107 Class field name 'EK' should start with 'F'
[FixInsight Convention] ncEncIdea.pas(20): C107 Class field name 'DK' should start with 'F'
[FixInsight Convention] ncEncMars.pas(20): C107 Class field name 'KeyData' should start with 'F'
[FixInsight Warning] ncEncMars.pas(171): W528 Variable 'j' not used in FOR-loop
[FixInsight Convention] ncEncMd4.pas(20): C107 Class field name 'LenHi' should start with 'F'
[FixInsight Convention] ncEncMd4.pas(20): C107 Class field name 'LenLo' should start with 'F'
[FixInsight Convention] ncEncMd4.pas(21): C107 Class field name 'Index' should start with 'F'
[FixInsight Convention] ncEncMd4.pas(22): C107 Class field name 'CurrentHash' should start with 'F'
[FixInsight Convention] ncEncMd4.pas(23): C107 Class field name 'HashBuffer' should start with 'F'
[FixInsight Convention] ncEncMd5.pas(20): C107 Class field name 'LenHi' should start with 'F'
[FixInsight Convention] ncEncMd5.pas(20): C107 Class field name 'LenLo' should start with 'F'
[FixInsight Convention] ncEncMd5.pas(21): C107 Class field name 'Index' should start with 'F'
[FixInsight Convention] ncEncMd5.pas(22): C107 Class field name 'CurrentHash' should start with 'F'
[FixInsight Convention] ncEncMd5.pas(23): C107 Class field name 'HashBuffer' should start with 'F'
[FixInsight Convention] ncEncMisty1.pas(23): C107 Class field name 'KeyData' should start with 'F'
[FixInsight Convention] ncEncRc2.pas(20): C107 Class field name 'KeyData' should start with 'F'
[FixInsight Convention] ncEncRc4.pas(20): C107 Class field name 'KeyData' should start with 'F'
[FixInsight Convention] ncEncRc4.pas(20): C107 Class field name 'KeyOrg' should start with 'F'
[FixInsight Convention] ncEncRc5.pas(23): C107 Class field name 'KeyData' should start with 'F'
[FixInsight Convention] ncEncRc6.pas(23): C107 Class field name 'KeyData' should start with 'F'
[FixInsight Convention] ncEncRijndael.pas(24): C107 Class field name 'numrounds' should start with 'F'
[FixInsight Convention] ncEncRijndael.pas(25): C107 Class field name 'rk' should start with 'F'
[FixInsight Convention] ncEncRijndael.pas(25): C107 Class field name 'drk' should start with 'F'
[FixInsight Convention] ncEncRipemd128.pas(20): C107 Class field name 'LenHi' should start with 'F'
[FixInsight Convention] ncEncRipemd128.pas(20): C107 Class field name 'LenLo' should start with 'F'
[FixInsight Convention] ncEncRipemd128.pas(21): C107 Class field name 'Index' should start with 'F'
[FixInsight Convention] ncEncRipemd128.pas(22): C107 Class field name 'CurrentHash' should start with 'F'
[FixInsight Convention] ncEncRipemd128.pas(23): C107 Class field name 'HashBuffer' should start with 'F'
[FixInsight Convention] ncEncRipemd160.pas(20): C107 Class field name 'LenHi' should start with 'F'
[FixInsight Convention] ncEncRipemd160.pas(20): C107 Class field name 'LenLo' should start with 'F'
[FixInsight Convention] ncEncRipemd160.pas(21): C107 Class field name 'Index' should start with 'F'
[FixInsight Convention] ncEncRipemd160.pas(22): C107 Class field name 'CurrentHash' should start with 'F'
[FixInsight Convention] ncEncRipemd160.pas(23): C107 Class field name 'HashBuffer' should start with 'F'
[FixInsight Convention] ncEncSerpent.pas(20): C107 Class field name 'l_key' should start with 'F'
[FixInsight Convention] ncEncSha1.pas(20): C107 Class field name 'LenHi' should start with 'F'
[FixInsight Convention] ncEncSha1.pas(20): C107 Class field name 'LenLo' should start with 'F'
[FixInsight Convention] ncEncSha1.pas(21): C107 Class field name 'Index' should start with 'F'
[FixInsight Convention] ncEncSha1.pas(22): C107 Class field name 'CurrentHash' should start with 'F'
[FixInsight Convention] ncEncSha1.pas(23): C107 Class field name 'HashBuffer' should start with 'F'
[FixInsight Convention] ncEncSha256.pas(20): C107 Class field name 'LenHi' should start with 'F'
[FixInsight Convention] ncEncSha256.pas(20): C107 Class field name 'LenLo' should start with 'F'
[FixInsight Convention] ncEncSha256.pas(21): C107 Class field name 'Index' should start with 'F'
[FixInsight Convention] ncEncSha256.pas(22): C107 Class field name 'CurrentHash' should start with 'F'
[FixInsight Convention] ncEncSha256.pas(23): C107 Class field name 'HashBuffer' should start with 'F'
[FixInsight Convention] ncEncSha512.pas(21): C107 Class field name 'LenHi' should start with 'F'
[FixInsight Convention] ncEncSha512.pas(21): C107 Class field name 'LenLo' should start with 'F'
[FixInsight Convention] ncEncSha512.pas(22): C107 Class field name 'Index' should start with 'F'
[FixInsight Convention] ncEncSha512.pas(23): C107 Class field name 'CurrentHash' should start with 'F'
[FixInsight Convention] ncEncSha512.pas(24): C107 Class field name 'HashBuffer' should start with 'F'
[FixInsight Convention] ncEncTea.pas(20): C107 Class field name 'KeyData' should start with 'F'
[FixInsight Warning] ncEncTea.pas(104): W528 Variable 'n' not used in FOR-loop
[FixInsight Warning] ncEncTea.pas(128): W528 Variable 'n' not used in FOR-loop
[FixInsight Convention] ncEncTiger.pas(21): C107 Class field name 'Len' should start with 'F'
[FixInsight Convention] ncEncTiger.pas(22): C107 Class field name 'Index' should start with 'F'
[FixInsight Convention] ncEncTiger.pas(23): C107 Class field name 'CurrentHash' should start with 'F'
[FixInsight Convention] ncEncTiger.pas(24): C107 Class field name 'HashBuffer' should start with 'F'
[FixInsight Convention] ncEncTwofish.pas(32): C107 Class field name 'SubKeys' should start with 'F'
[FixInsight Convention] ncEncTwofish.pas(33): C107 Class field name 'sbox' should start with 'F'
[FixInsight Warning] ncEncTwofish.pas(98): W528 Variable 'i' not used in FOR-loop
[FixInsight Warning] ncEncTwofish.pas(108): W528 Variable 'i' not used in FOR-loop
[FixInsight Warning] ncEncTwofish.pas(119): W528 Variable 'i' not used in FOR-loop
[FixInsight Warning] ncEncTwofish.pas(169): W528 Variable 'nJ' not used in FOR-loop
[FixInsight Warning] ncEncTwofish.pas(183): W528 Variable 'nJ' not used in FOR-loop
[FixInsight Optimization] NetComRegister.pas(96): O802 ResourceString 'resAboutTitle' is declared but never used
[FixInsight Optimization] ncEncRijndael.pas(43): O803 Constant 'MAXBC' is declared but never used
[FixInsight Optimization] ncEncRijndael.pas(44): O803 Constant 'MAXKC' is declared but never used
NC7 is not support SSL
How to TCP servers can be restricted to listening certain IP address or IP address range?
After recent changes ExecCommand has stopped working when EventsUseMainThread is true.
The server does receive the message but client doesn't seem to receive response from server and instead raises ENetComCommandExecutionTimeout.
Thanks.
Was trying to install to evaluate (Delphi 11) and I get this error : [dcc64 Fatal Error] NetComRegister.pas(16): F2613 Unit 'ToolsAPI' not found. any ehlp would be appreciated. Need a solid socket server/client solution that can deal with wifi disconnects etc.
The TncSourceBase class provides a TCP server that uses the TncTCPBase as the underlying socket. Then, when data is received, it processes the received stream into "commands" that are then executed by a processing Thread by pulling one from the TncThreadPool. The problem with this is that it would be nice to use the TncThreadPool to handle server processing of a message without relying on this network protocol that defines the command mechanism. We would like to use this library and the TncTheadPool, but we have our own protocol. Because these two concerns are both implemented in the TncSourceBase, we would have to re-write our own replacement to this class to make it work with our message framing mechanism. If this class could be split into two concerns, one for processing received data within one of the threads in the threadpool, and the other for parsing the received data into messages, then we could more easily make our own protocol message handler and still benefit from the processing threadpool.
Good Job. Thank you.
I have Modified two point on Delphi 12 Athens ...
Need TypeCast ...
function TncLine.GetReceiveTimeout: Integer;
var
Opt: DWord;
OptSize: Integer;
begin
OptSize := SizeOf(Opt);
{$IFDEF MSWINDOWS}
Check(GetSockOpt(FHandle, SOL_SOCKET, SO_RCVTIMEO, PAnsiChar(@opt), OptSize));
{$ELSE}
Check(GetSockOpt(FHandle, SOL_SOCKET, SO_RCVTIMEO, Opt, socklen_t(OptSize))); <-- TypeCast by socklen_t
{$ENDIF}
Result := Opt;
end;
Need Escape Block ...
{$IFDEF MSWINDOWS}
procedure TConnectThread.ProcessEvent; <-- Escape from MSWINDOWS Block ...
...
{$ENDIF}
Apparently there is a memory leak in ExecCommand, as reported by FastMM, it seems to be the allocation
New(PendingCommand);
try
which is then conditionally released here
finally
if aRequiresResult and not aAsyncExecute then
Dispose(PendingCommand);
end;
So I'm not sure what the logic is and haven't looked deeper in code, but when using ExecCommand with aRequiresResult =false and Async =true FastMM reports a leak
On line 122 in nSources.pas there is this line
TncOnSourceHandleCommand = function(Sender: TObject; aLine: TncSourceLine; aCmd: Integer; aData: TBytes; aRequiresResult: Boolean; const aSenderComponent, aReceiverComponent: string): TBytes of object;
could be changed to
TncOnSourceHandleCommand = function(Sender: TObject; aLine: TncSourceLine; aCmd: Integer; const aData: TBytes; aRequiresResult: Boolean; const aSenderComponent, aReceiverComponent: string): TBytes of object;
Typically the event calls a method with a signature like
function OssHandleCommand(Sender: TObject; aLine:
TncSourceLine; aCmd: Integer; const aData: TArray<System.Byte>; aRequiresResult:
Boolean; const aSenderComponent, aReceiverComponent: string):
TArray<System.Byte>;
and aData should not be modified. The compiler could then generate slightly more efficient code.
Btw I discovered this by Pascal Analyzer it is an excellent tool well worth the cost.
This line causes ERangeError
FLastSent := TStopWatch.GetTimeStamp;
The problem is that FLastSent is declared as Cardinal, but TStopWatch.GetTimeStamp returns an Int64.
FLastReceived is also a Cardinal, both should be changed to Int64.
And in general it would be good to test the code with RangeCheck turned on.
The project fails to compile because of two calls to InitializeMasterFields without the parameter.
hello DelphiBuilder , and congrats to your very good project ,
i would like to ask you if you can give us more demos about for example chat communication between two selected clients
lets say client one select client two to chat with , how do you implement that .
thanks have a nice day
Commit 50205fc introduces a simple manual client/server test program.
The test program fails when executing client sends in rapid succession, i.e., when hitting "Send from clients" multiple times in a row in which case some received messages appear as containing duplicated strings of the original message.
Some messages are flagged as CORRUPT. On inspecting any of these messages it can be seen that the reason for the message having been flagged is that the original message string has been repeated within the same message.
No messages are flagged as CORRUPT.
This issue may be related to #20.
Here goes. I love the simplicity of these components. However, there is one problem I have noticed.
I built a Windows test app using your TncTCPServer/TncTCPClient (NcSC810 zip file) and tried to talk back and forth with another Windows test app using TIdTCPServer/TIdTCPClient (IdSC810 zip file).
Both apps do acknowledge each other when their clients are connected.
Since there has been no activity here for the past 2 years I am not hopeful that this issue can be resolved, but you never know.
Thanks
In function TncThreadPool.RequestReadyThread: TncReadyThread
the variable i
used for thread index is not defined:
Threads[ High(Threads)].Priority := Threads[0].Priority;
Threads[i].ReadyEvent.WaitFor(1000);
I guess it's supposed to be High(Threads)
instead of i
, can you verify that ?
The intention is for server to "broadcast" changes received from one client to all other connected clients with least amount of latency.
Testing Client/Server Sources demos so that Server pushes changes reveals an issue with messages time out when RequiresResult=false and AsyncExecute=True
Reproducible by applying following changes to ncServerSourceHandleCommand:
function TForm1.ncServerSourceHandleCommand(Sender: TObject;
aLine: TncSourceLine; aCmd: Integer; aData: TArray<System.Byte>;
aRequiresResult: Boolean; const aSenderComponent,
aReceiverComponent: string): TArray<System.Byte>;
var
Line: TncSourceLine;
Sockets: TSocketHandleList;
i: integer;
begin
// Comment out the following line if you want to test the server's real response speed
Memo1.Lines.Add('Given response for data: ' + StringOf (aData));
Result := aData;
Sockets := ncServerSource.Lines.LockList;
try
for i := 0 to Sockets.Count - 1 do
begin
Line := Sockets.Objects[i] as TncSourceLine;
if Line <> aLine then
ncServerSource.ExecCommand(Line,0, BytesOf('Test'+IntToStr(i)), false, true);
end;
finally
ncServerSource.Lines.UnlockList;
end;
Run server with code above and also run at least two clients.
Send message from one client and other clients should receive it. While it sometimes works, it raises a TimeOut more often than not.
With RequiresResult to True it works correctly.
Also with RequiresResult=false and AsyncExecute=false it works correctly.
Is RequiresResult=false and AsyncExecute=True unsupported, or is it a bug ?
I find that when shutting down clients and disconnecting by setting Active to false secondary thread raises an exception.
It happens in function ReadableAnySocket
:
if iRes = SOCKET_ERROR then
raise TncLineException.Create('Socket error');
It's caught and swallowed by TncClientProcessor.ReadableSocket
, but still doesn't feel right.
It's called from TncClientProcessor.SocketProcess
which would avoid the exception if it was Terminated
, but it's not.
What is the proper shutdown strategy to avoid this exception ?
Not saying this isn't fast, but if you provide some simple test to compare it to let's say Indy and ICS.
There are others, but might be HTTP only or not client server solution. Grijjy has TCP-socket client at least I think. Many have interesting HTTP server and client stuff tough.
But anyhow, some numbers would do good.
-tee-
Hi there,
How to send unicode characters in simple socket demo? When I send Arabic characters, including non-Latin, it produce question marks (???) on the client side.
An help is highly appreciated.
Hello.
Looks great but I have a problem.
Installed via GetIt package manager on Delphi 13.
None of the encryption components seem to load. e.g.
[dcc64 Fatal Error] ncEncryption.pas(18): F2613 Unit 'ncEncCrypt2' not found.
Am i doing something wrong?
k
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.