Forum > Windows

[SOLVED] Compiled indy laz web server on win 7, cannot serve on win 10

<< < (2/2)

I just now checked and it works without any problem. Compilation on Win7 without sp1 (lazarus 2.2.2/fpc 3.2.2), running on Win7 (checked in IE8) and Win10 (checked in Firefox)
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---const  page = '<html><head><title>Indy test</title></head>' +    '<body><center><font size=7><b>Indy test</b></font><br>' +    '<i>Your IP: {%ip}<br>Your UserAgent: {%agent}</i></center></body></html>'; procedure TForm1.FormCreate(Sender: TObject);begin  Memo1.Lines.Clear;  IdHTTPServer1.DefaultPort := 80;  IdHTTPServer1.Bindings.Add.Port := 80;  IdHTTPServer1.Active := True;end; procedure TForm1.FormDestroy(Sender: TObject);begin  IdHTTPServer1.Active := False;end; procedure TForm1.IdHTTPServer1CommandGet(AContext: TIdContext;  ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);var  pagetmp: String;begin  Memo1.Lines.Add(Format('Command: %s, IP: %s, UserAgent: %s', [ARequestInfo.Command, ARequestInfo.RemoteIP, ARequestInfo.UserAgent]));  pagetmp := StringReplace(page, '{%ip}', ARequestInfo.RemoteIP, [rfReplaceAll]);  pagetmp := StringReplace(pagetmp, '{%agent}',    ARequestInfo.UserAgent, [rfReplaceAll]);  AResponseInfo.ResponseNo := 200;  AResponseInfo.ContentType := 'text/html';  AResponseInfo.ContentText := pagetmp;  Memo1.Lines.Add('---------------------------');end;   

It seems a bogus question. All code works even on win11. Maybe remove it as spam?

Remy Lebeau:

--- Quote from: paweld on February 06, 2023, 04:10:05 pm ---
--- Code: ---procedure TForm1.IdHTTPServer1CommandGet(AContext: TIdContext;
  ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
  pagetmp: String;
  Memo1.Lines.Add(Format('Command: %s, IP: %s, UserAgent: %s', [ARequestInfo.Command, ARequestInfo.RemoteIP, ARequestInfo.UserAgent]));
  pagetmp := StringReplace(page, '{%ip}', ARequestInfo.RemoteIP, [rfReplaceAll]);
  pagetmp := StringReplace(pagetmp, '{%agent}',
    ARequestInfo.UserAgent, [rfReplaceAll]);
  AResponseInfo.ResponseNo := 200;
  AResponseInfo.ContentType := 'text/html';
  AResponseInfo.ContentText := pagetmp;

--- End code ---

--- End quote ---

Just an FYI, the TIdHTTPServer.OnCommand... events are fired in the context of worker threads, so you need to synchronize with the main UI thread when touching UI controls, like Memo1.

Remy Lebeau:

--- Quote from: Mongkey on February 06, 2023, 11:55:59 am ---My server running well on win7, but do nothing on win 10?

--- End quote ---

You need to be MUCH more specific.

What EXACTLY is not working for you?  Are you getting any errors?  Are you running your HTTP clients on the same machine as your HTTP server, or are they connecting to your HTTP server over a LAN, or the Internet?  Are the clients able to connect to your HTTP server at all, but are just not able to send requests and/or receive responses?  Have you tried sniffing the network with a packet sniffer like Wireshark to see if there are any traffic issues?

How do you expect people to help you when you don't explain WHAT is going wrong for you?

--- Quote from: Mongkey on February 06, 2023, 11:55:59 am ---Brook also do nothing on win 10, if i compiled the server on win 7.

--- End quote ---

What is Brook?

--- Quote from: Mongkey on February 06, 2023, 11:55:59 am ---Does it need to be built on same environment to run?

--- End quote ---


Hello remy, indy worked over windows, i already inspect all of my code, i forgot, i was dissabling binding for spesific port, sorry  :D. Brook is another lazarus web server component using libhttpd, brook worked also, the problem is just my firebird on win 10. Thank you all.

This prototype is using indy as data streamer over network.
Thank you.


[0] Message Index

[*] Previous page

Go to full version