#1 2020-10-22 08:01:59

damiand
Member
From: Greece
Registered: 2018-09-21
Posts: 94

Cross platform SMS sample - GetClient with generic server address

I modified slightly the Sample 27 - SMS cross platform client to use it in a reverse proxy nginx setup. It works only when the server address parameter of the GetClient method contains a specific address (either 127.0.0.1 or my local ip). Is there any way to pass a generic value to use the host ip address, whatever it is? I tried both the empty string and '/' without success.

By the way in the Smart Mobile Studio project, the assignment of Client to nil and the if check at the first line of the TForm1.BtnConnectClick event handler, doesn't seem to work:

  if Client=nil then
     ...  
  else begin
    ...
    Client.Free;
    Client := nil;
  end;

A second press on the 'Server Connect' button produces nothing because the Client object hasn't become nil. A raw and clumsy solution like the following, does the work properly:

  if BtnConnect.Caption='Server Connect' then
        ...
        BtnConnect.Caption := 'Disconnect';
        ...
  else begin
        ...
    BtnConnect.Caption := 'Server Connect';
        ...
  end;

Offline

#2 2020-10-22 08:15:27

damiand
Member
From: Greece
Registered: 2018-09-21
Posts: 94

Re: Cross platform SMS sample - GetClient with generic server address

I found a solution by passing window.location.hostname. Sorry for my rather silly question. roll

Offline

Board footer

Powered by FluxBB