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!