Jump to content

aehimself

Members
  • Content Count

    1030
  • Joined

  • Last visited

  • Days Won

    22

Posts posted by aehimself


  1. Do you need parsing too, or only to beautify the code? I wrote a unit which beautifies and simplifies (remove idents and formatting to reduce size) XML documents and it's using only string helper functions. It formats a ~14 MB XML file in about 300ms, however this heavily depends on the amount of tags.

    Since the structure is very close I suppose it can work with HTML.

     

    If you don't want to use components / libraries let me know, I can send you the code.


  2. Hello,

    Thanks for the insanely fast reply, I truly appreciate it!

    All the code in my threads Execute method was uncommented once (I just commented them out when they did not bring the desired result) so my message pump was indeed in place.

     

    The only thing I did not consider is that the component is taking the caller thread as it's parent, and not where it is actually located! When I create the component in Execute it starts to work!!! Thank you very much, I would have never guessed this.

     

    Due to the nature of how I see code - is there a way to keep the creation in the OnCreate, and destriction in the Destroy method of the thread? I do not wish to create and assign a Client thread to each connection (Win2000 and Win2003 has really bad thread handling and I would like to stay compatible!) and a simple myhttpsrv.ThreadAttach in the beginning of the Execute does not bring joy.

     

    If not - I'll just stick to this solution.

     

    Thank you again!


  3. Hello,
    I'm sorry if this topic was discussed several times, I was able to find only a REALLY low amount of information and none of them seemed to work.
    I need to create a TSslHttpServer (in runtime) and serve the client requests. Everything went fine in my test app so I started to port it to it's final state but it refused to work. Port is opened but no events are being fired. Since I already met this with the standard TClientSocket / TServerSocket so I quickly put my message pump generator in the Repeat...Until Terminated cycle in my main thread.
    No joy, so I started to investigate. I already found that I should do something with the NOFORMS directive but I was unable to make it work. Result is always the same: connection to the opened port is possible, but no events are fired in my Delphi app, nor the connection responds.

    - I added the NOFORMS directive to the ICS install package and rebuilt all
    - I added the NOFORMS directive to my app and rebuilt all
    - I added the {$DEFINE NOFORMS} to my app's dpr
    - tried enabling or disabling the MultiThreaded property
    - Tried moving to my messagepump to SslHttpServer.OnMessagePump
    - Tried SslHttpServer.ProcessMessages, .MessagePump, .MessageLoop

    I also mixed the above, meaning tried each combination of each message processor method with each directive.

     

    TMyThread = Class(TThread)
    strict private
     myhttpsrv: TSslHttpServer;
    [...]

    Constructor TMyThread.Create;
    Begin
     myhttpsrv := TSSlHttpServer.Create(nil);
     myhttpsrv.OnClientConnect := WebServerClientConnect;
     myhttpsrv.OnMessagePump := WebServerMessagePump;
    [...]

    Procedure TMyThread.Execute;
    Begin
     Repeat
      If Not _httpsrv.ListenAllOK Then _httpsrv.Start;
    //  myhttpsrv.ProcessMessages;
    //  myhttpsrv.MessageLoop;
    //  myhttpsrv.MessagePump;
     Until Terminated;
    [...]

    Procedure TMyThread.WebServerClientConnect(Sender: TObject);
    Begin
     WriteLn('Client connected...');
    [...]

    Procedure TMyThread.WebServerMessagePump(Sender: TObject);
    Begin
    If PeekMessage(msg, 0, 0, 0, 0) Then Begin
     GetMessage(msg, 0, 0, 0);
     TranslateMessage(msg);
     DispatchMessage(msg);
    End;
    [...]

     

    What I am doing wrong? Any ideas on how I can make it work?
    Thanks!

×