Anonymous User
  Tuesday, 15 July 2025
  6 Replies
  10.8K Visits
  Subscribe
Hello,
I'd like to know if the WS server component can run in a console application under linux.

This server goal will be to receive file chunks (i.e. upload of huge files)

So I want to put your TsgcWSServer in a service (stopped by SIGTERM) along with my handling of those chunks.

My question being : As the run loop in the main thread of this service will be set as something like this :


WSServer.Active := True;

while is_running do 
  sleep(1000);

WSServer.Active := False;


do you have anything in your server code that makes a GUI requirement mandatory and/or could potentially deadlock because of this constantly sleeping main thread ?

I assume it can work but it cost nothing to ask to be sure !

Any feedback on this will be appreciated. I'm waiting for it to decide a purchase.
1 week ago
·
#2323
Hello,

Yes, the websocket server will run on linux, just make sure you set the property notifyEvents := neNoSync to avoid thread synchronization problems.


program sgcWebSockets_linux;
 
{$APPTYPE CONSOLE}
 
{$R *.res}
 
uses
  System.SysUtils, sgcWebSocket, sgcWebSocket_Types;
 
var
  oServer: TsgcWebSocketServer;
 
begin
  try
    oServer := TsgcWebSocketServer.Create(nil);
    oServer.Port := 5000;
    oServer.NotifyEvents := neNoSync;
    oServer.Active := True;
 
    while oServer.Active do
      Sleep(10);
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.


Kind Regards,
Sergio
1 week ago
·
#2324
Thank you. In fact even before your answer I took 30 min. to code a test server with the trial version and it worked without effort.

I'd also say that I've been really impressed by the upload speed that I managed to achieve, ~6.5 Gbps upload speed over internet connection (and I think the limiting factor was the Disk IO). This is really much faster that I ever was able to achieve using nginx + php

So I've purchased a license.

One feedback / suggestion: I don't like to have some html / js parts stuffed in the sgcResources.RES file, without having the individual files available and optionally compilable after with a sgcResources.RC script . I will definitively need a custom .js source served instead of the default "sgcWebSockets.js" , and while it is probably trivial to add a user .js, I'd have appreciated to be able to modify the one in ressources at compile time more easily.
1 week ago
·
#2325
Hello,

You can find the sgcResources.RES individual files inside the resources folder of the sgcWebSockets installation.
The sgcResources.rc defines all the resources and the sgcResources.bat compiles the sgcResources.res file.

Kind Regards,
Sergio
1 week ago
·
#2326
There was neither resources folder nor individual files provided by the installer that I have used (the latest Beta), and no option to trigger this (I took full installation)

So unless they are in another location or I have missed something during the installation process, they were not provided in this installer.
1 week ago
·
#2327
adding that the size of the beta installer being roughly half the size of the latest release build, I can safely assume that this resources folder is not present in the beta installer.
1 week ago
·
#2328
Hello,

Yes, the beta doesn't include the resources folder, if you download the latest release you'll get the resource folder in your installation.

Kind Regards,
Sergio
  • Page :
  • 1
There are no replies made for this post yet.
Submit Your Response
Upload files or images for this discussion by clicking on the upload button below.
Supported: gif,jpg,png,jpeg,zip,rar,pdf,pas,dfm,dpr,dproj,dpk
· Insert · Remove
  Upload Files (Maximum 10MB)