Jump to content

DelphiUdIT

Members
  • Content Count

    593
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by DelphiUdIT

  1. I don't use cosole application, i use a graphic (FMX) application (based on Indy demo). This is for ease of use only. In fact, the FORM does nothing except handle events and start / stop the server. All LOGs are sent to the console via writeln. Exact same thing in Linux. Now with TLS 1.3 support Bye P.S.: There is one flaw in certificate management, which is that the certificate's private key must be exposed and accessible to the application. This may be a vulnerability if the server is accessed locally by third parties.
  2. DelphiUdIT

    memory paging or segmentation

    When you use getmem, in general, you are given a virtual memory address expressed in this form: xxxx:0, whose length depends on how many bytes you allocate. If for example if you allocate 1000 bytes it will be: xxxx:0 - xxxx:999 Where xxxx is called segment. If you try to use xxxx:1000 you exit the memory segment and the segm "segment" error is thrown. This is a HARDWARE protection mechanism and you can do nothing to avoid it. I repeat, avoid using the logic of the "C" language and use the form and rules of "Pascal", they will help you avoid these errors. HI.
  3. As mentioned in a previous post, I use classic (raw) UDP communication because Thethering is not normally supported in the industrial environment. To give an example of UDP performance and reliability (in this context, it may not be appropriate for other applications), I explain an application developed and in operation with 20 plants in operation for 5 years (some for 5 years, some for 1 year). The software runs on a PC with 3 x 1Gbit network cards and a USB / GigaEthernet adapter. There are 6 to 18 devices connected to the local network and they use only UDP communications. The average traffic on the various PC network cards is 150 Mbit to 750 Mbit per card. The PC software to trigger the devices (basically cameras) transmits between 500 thousand and one million UDP packets (for synchronization only) per day (10 / 12 hours of continuous work 7 days a week). If even one packet is lost the trigger chain stops, the plant stops, a log is updated and an email is sent to me to report this. In all installations, in all these years it has never happened that a UDP packet has been lost. Of course, all the hardware has been designed to ensure maximum reliability, starting from the power supply and network components such as switches. Creating a reliable network using UDP is possible in certain scenarios. Bye
  4. 1) It depends on how the COM Server is built: from Windows 7 onwards any application that works as a service cannot have ANY REFERENCE to graphic objects of any type or kind nor access to the graphic surface (obviously not even as an indirect reference). The only exception is to show a "message" window, even before logging in with a specific API. A service cannot launch a "normal" COM, ie which refers to graphical parts, but it can dialogue with a COM object already "running". I dont' know if the last implementation something is changed (is a lot of years that i don't develop COM object) As @david-heffernan mentioned, the COMs can be used even without registration using the sXs technology, basically a Windows Manifest describes it (but it can be used only and exclusively if the COM is built as "inprocess" and this is not compatible with a windows service). Now, the references I had for using this technology (which doesn't use .NET components) are no longer available. 2) Preventing multiple instances of the same application is simple to implement. And if you want to prevent multiple unwanted parallel "tasks" from being executed, for example The service might pause (almost) when it detects the GUI executable (after it has done all its operations). However, the interaction mechanism between a Windows service and an EXE application is relatively simple. 3) For multiprocess communication I always use TCP communication (Indy components like TIdTcpClient / Server) and sometimes (actually very often in industrial applications) I use UDP in BROADCAST.
  5. DelphiUdIT

    Image pool server

    Answering your question is very difficult. It all depends mainly on what the final goal of the application is and how the various processes are imposed on you. What is the infrastructure available (local computation, cloud, distributed computing)? Will the image acquisition be synchronous or asynchronous, will they be serialized? Does the application prioritize speed? Etc .... Bye
  6. DelphiUdIT

    memory paging or segmentation

    As @PeterBelow wrote to you, what you indicated can be written more simply, readably and effectively in Pascal. It looks like you're writing "C" code. Just in case, to explain better you can write this code which allows you to: 1) In case of fixed extensions, to avoid some errors because they are already checked during compilation; 2) However, in case of errors (as in dynamic extensions), much clearer errors will be generated (erange errror: "Range Check Error"); 3) You can use the Low, High methods to automatically limit the cycles to the maximum extent of the arrays, avoiding the risk of "overshooting" the limits. //Static array var ballnumber: array [0..6999] of byte; i: integer; begin for i := Low(ballnumber) to High(ballnumber) do ballnumber[i] := 5; end; //Dynamic array var ballnumber: array of byte; i: integer; begin try SetLength(ballnumber, 7000); //<----Like GetMem for i := Low(ballnumber) to High(ballnumber) do ballnumber[i] := 5; finally SetLength(ballnumber, 0); //<---- Like FreeMem end; end;
  7. I used two standalone Indy web server (https): one in a Linux server and one in a Windows 11 system. The web servers (Linux and Windows are the same, simple compiled for different OS) use a TLSv1_2 secure connection and were tested in one year with direct public connection without any filter. SSLLabs (SSL Labs - Test SSL web server) give a valuation of "A" grade to the web server. Tipically every day the application registered 1 thousand of attack, some are simple scanners like others are trying to violate the server. The web servers never went down. With new processors and systems, the number of the Threads is not a problem. I think that Indy is more than mature to use in a production enviroment. Bye
  8. DelphiUdIT

    OpenSSL fails to Load

    This is the version of the arm 64 (arm64-V8a). The others should be the same. Fips means that are compiling with some cryptography function ? I thought fips modules could only be compiled with OPENSSL 3.
  9. DelphiUdIT

    OpenSSL fails to Load

    I have the *.so OpenSSL 1.02 library for all Android SO (x86, x86_64, V7a, V8a) ... they are all date 14/06/2022 and may be the version is 1.02s I really don't know where i found them, and since I also use Indy SSL I researched all libraries for all supported systems. Like i told, I don't know who "create" the library but I used them and no problems were found. Bye openssl-1.02_Android.zip
  10. DelphiUdIT

    How can I programmatically connect to a VPN?

    Using the the Jedi (JVCL) unit JvRas32 you can connect to a any VPN created in Windows (i used it lot of years ago only with Microsft VPN), i don't know if it is actual working:
  11. MQTT is a standard protocol, define define by IETF RFC2119 and whose communication resources are reserved by IANA (TCP V4 Port 1883 and 8883). Oasis organization has take care to introduce some "working" improvement (marking them as "non-normative") to really be used in operative production environment (eg. IoT), and is the "the facto standard". P.S.: most of industrial electronic companies make some products compatible to MQTT, like OPC SERVER (often used to communicate with sensors). Often they do that in "modbus" products with which MQTT has vague similarities. Bye
  12. If one publish a "retain" message, this message will remain "online" until it will be clean or override (eg. publish another message, retain or not). While the message is retain every one can subscribe and receive it. If the message it's clear or override, it's lost for ALL. MQTT is designed to maintain only the last message. Of course I talk about one "topic", one can publish as many topic as he wants. Bye
  13. This may be, but to enable 64 bit ASLR you must enable "HIGH ENTROPY". Enable only ASLR and disable HE should not produce pointer with 64 bit data ..... or i misunderstand ASLR ? With my test i try the two combination (ASLR or ASLR + HE) and i had some problems anyway.
  14. I don't understand very well what you are thinking to do. But remember that MQTT is not a database, it doesn't present you a storytime of alerts, it works on time basis and is totally asynchronous. If i publish a message (thinking that is a retain), until this message "stay" there all can view that, but when the message will clear (or change) .... who read the message its ok, the workstations that were offline and cannot read that "lost that message". Of course you can publish a message like a storyboard shifting all every time, but this is not the scope of the MQTT. If you made a broker or can control a broker, of course you can know how many clients are online and you can decide what to do. Bye
  15. In Delphi 11.2 ASLR (and High Entropy too) may be used and is working. But when i tested it in a real running environment, there were some glitches (AV, memory leak, ....) that don't show up if I simply turn off ASLR. I've noticed that the use of 3rd party dlls (SDK or whatever) even if recent plays a role in this. All of course in a 64-bit environment. I didn't go into depth because I'm busy on several fronts, but in the near future I'd like to go into it further. For now I don't use ASLR and High Entropy. Bye
  16. I'm implementing a new feature to the software I've produced that used e-mail as an alert. Now I'm also testing mosquitto as a server and I'm rebuilding a new MQTT client starting from an old repository on github https://github.com/wizinfantry/delphi-mqtt-client (that version is not working with new enviroment and needs some refresh). The current version of mosquitto supports up to the latest version of MQTT (MQTT 5.0 https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.pdf), SSL (up to TLS 1.3), TCP or websockets. Also you can connect to other brokers. And with retains, there's no problem at all losing alerts, especially using mobile devices as clients. In my opinion, since the server (broker) is already ready, implementing MQTT having a good Delphi "component" allows you to easily manage alerts. Bye P.S.: in this Embarcadero article there is more info and link to a client and broker MQTT write in Delphi: https://blogs.embarcadero.com/learn-how-to-use-the-mqtt-protocol-in-delphi-with-this-library/
  17. DelphiUdIT

    Turn display Off/On

    PostMessage(HWND_BROADCAST , WM_SYSCOMMAND, SC_MONITORPOWER, 2); This should works, it always works in every version of Windows. If it not works, it's possible that you have some drivers, services or others that prevents you from turning it off. Any movements of the mouse and key pressing turn on the monitor. Bye
  18. DelphiUdIT

    Turn display Off/On

    To turn monitor on simply simulate a keypressed: //Simulate the pression of SHIFT key ... keybd_event(VK_SHIFT, 0, 0, 0); keybd_event(VK_SHIFT, 0, KEYEVENTF_KEYUP, 0); Bye
  19. DelphiUdIT

    Zeos on Delphi 11.2

    Download from the official GH repository. Unzip to a folder of your liking. In the Packages\DelphiXE10.4 directory open the group project ZeosDbo.groupproj For each single project present, go under options and change, UNDER THE ITEM DESCRIPTION, libsuffix with the value 280 BUILD ALL, after that INSTALL "ZComponentDesign280.bpl". All should be done as Windows 32 as target platform. After that close all. Restart IDE, go to TOOL/OPTIONS/Language/Delphi/Library. Select the Platform and in the Library path you must add the path to the SRC subfolders (includes SRC) ... core, component, dbc, parsesql, plain. You must add in the Library Path of every Platforms that you want to use (Windows 32 and WIndows 64 for example). Now you are ready to use Zeos, but ... in the repository (lib) there are only drivers for 32 bit DB. You must install the runtime DB (FireBird x64 for example) to use it in the 64 bit application. Bye
  20. In the JVCL exist that component: TJvDialButton. You can use it or start study that component. Bye
  21. DelphiUdIT

    Web-fonts v Desktop-fonts

    I'll give you the answer in Delphi as indicated in this link Pascal load font form resource (embedded in exe). Converting it to C shouldn't be a problem. Make a text file and rename it 'resource.rc'; Put inside a line like this (you can insert how many fonts do you need): LCDN RCDATA ".\LCDN.TTF" The meaning of the data is: "Name of the resource" "Resource Type" "Font FIle Name" Insert the file "resource.rc" in you project; By doing so, you insert the font into your executable and you don't have to extract it or anything else. This is a simple code in pascal to use it: function LoadResourceFontByName( const ResourceName : string; ResType: PChar ) : Boolean; var ResStream : TResourceStream; FontsCount : DWORD; begin ResStream := TResourceStream.Create(hInstance, ResourceName, ResType); try Result := (AddFontMemResourceEx(ResStream.Memory, ResStream.Size, nil, @FontsCount) <> 0); finally ResStream.Free; end; end; procedure TForm1.FormCreate(Sender: TObject); begin if LoadResourceFontByName('LCDN', RT_RCDATA) then //THIS 'LCDN' IS THE NAME OF THE RESOURCE Label1.Font.Name := 'LCDN'; //THIS 'LCDN' IS THE INTERNAL NAME OF THE FONT AND SHOULD BE KNOW (CAUSE THE FONT FILE MAY CONTAIN MORE TYPE LIKE BOLD, OR OTHERS) end; end.
  22. Some time ago I had a similar problem with RESOURCESTRING, both in overwriting (with the VirtualProtect function) and with LOADRESSTRING in multithreading. Since that time I have created a unit in which I perform all the functions of loading the resources and their eventual overwriting by calling it at the end of the initialization of all the other modules, and since then I have not had more problems. I mainly use the function for translation purposes.
  23. DelphiUdIT

    IDE it's not working anymore

    I don't know if this will help, but in the "KNOW ISSUE OF THIS UPDATE" (link to Microsoft KB of the last Update: Win 10 last update ). They talk about problems with applications that use "certain" audio devices. Bye
  24. My mistake. This is the correct code: function cntCaseTbl(Z: Int64): Int64; begin Result := 0; //This should be, otherwise the result will be random value if z > 0 then Result := Trunc(Log10(z))+1; else if z = 0 then Result := 1; end;
  25. I have tried all limit values 1, 10, 100, 1000, 10000, ....., 9, 99, 999, 9999, 99999, ...... And all the returned values are correct.
×