FreePascal/Linux daemon or Apache extension

Hello,
Please change {$R RODLFile.res} to {$R RODLFILE.res} in project file.

Hi

Thx but I don’t think that is the problem. “RODLFILE.res” seems to be set correctly…
Pls find attached the sample project.

Thx & cheers,
R.

I had this problem too in my FPC Server.

Before (error):
{$R *.res}

After (ok) :
{$R RODLFILE.res}

My file:
-rw-rw-r-- 1 cslog users 23270 Jan 31 23:34 RODLFILE.res

This is strange because “*” not works in FPC.

Thanks,
Willian.

Hello,
We tested your project.
Please try to use the following workaround:

uROClient.pas

procedure GetRodl(aStream: TStream; const aTransport : IROTransport; var aFormat : TDataFormat; ARODLReader: TROCustomRODLReader);
var rs : TCustomMemoryStream;
{$IFNDEF LCL}
instance : cardinal;
{$ENDIF}
begin

//{$IFDEF LCL}
//rs := TLazarusResourceStream.Create(res_RODLFile, nil);
//{$ELSE}
rs := TResourceStream.Create(hInstance, res_RODLFile, RT_RCDATA);
//{$ENDIF}

Thanks guys.

After both fixes above the WSDL is now served & shown in my web browser.

The next problem -> I use SoapUI and imported the WSDL to test the Sum() function.

When executing Sum() I get an exception on the server:

Project NewProject raised exception class “EStreamError” with message:
Failed to initialize component class “TNewService”: No streaming method available.

Maybe this is due to a faulty initialisation of the TRORemoteDataModule!?
Maybe related to this resource file that I don’t know where to find…

initialization
{$IFDEF LCL}
// {$I NewService_Impl.lrs}
{$ENDIF}

Thanks,
R.

Hello,
Use {$R *.dfm} instead of {$I NewService_Impl.lrs}.
Project Options -> Miscellaneous->Resource Type should be ‘FPC resource’ in this case.

You can also use TRORemotable as an ancestor (instead of TRORemoteDataModule).

Great -> Now the first linux daemon/skeleton app works with a TROIndyHTTPServer and a TROSOAPMessage. That’s half the rent!!

I now need the same but working with a TROSuperTCPServer and a TROBinMessage.

After this:

ROServer := TROSuperTCPServer.Create(nil);
ROServer.Port:=8095;
TROMessageDispatcher(ROServer.Dispatchers.Add).Message := ROMessageBin;
try
ROServer.Active := true;

I get an exception:

An unhandled exception occurred at $0821324E :
EIdSocketError : Socket Error # 98
Address already in use.

I might not understand well the concept of the SuperTCP Server -> Does this one need a “separate” free IP address to work?

Thanks,
R.

Hello,
Please modify IdCustomTCPServer.pas file:

procedure TIdCustomTCPServer.Startup;
begin
// Set up bindings
if Bindings.Count = 0 then begin
Bindings.Add; // IPv4
if GStack.SupportsIPv6 then begin
// maybe add a property too, so the developer can switch it on/off
//Bindings.Add.IPVersion := Id_IPv6; <<fixed
end;
end;

Vovanl,

This is a old bug, I reported it in May 2011 by e-mail (support@). I realize that some corrections bugs are not incorporated in the versions released. And this is bad because every time I update the sources, I have to fix the code again.

Willian.

Thx, I did the correction and the server works now.

When testing it from Windows using the RO Service Tester it works well!

However I think there is still an issue with TROSuperTCPChannel. I wrote a small test client on Linux looking like:

program SimpleClient;
{$IFDEF FPC}{$MODE DELPHI}{$ENDIF}
uses
{$IFDEF UNIX}
BaseUnix,
cThreads,
cMem,
{$ENDIF}
{$IFDEF MSWINDOWS}uROComInit,{$ENDIF}
SysUtils,
Classes,
uROBinMessage,
uROSuperTCPChannel,
NewLibrary_Intf in ‘NewLibrary_Intf.pas’,
NewLibrary_Invk in ‘NewLibrary_Invk.pas’,
NewService_Impl in ‘NewService_Impl.pas’;

var
lService: INewService;
lMessage: TROBinMessage;
lChannel: TROSuperTCPChannel;
a,b,c,i: Integer;
begin
try
lMessage := TROBinMessage.Create(TComponent(nil));
lChannel := TROSuperTCPChannel.Create(nil);
lChannel.Host:=‘192.168.20.17’;
lChannel.Port:=8095;
try
lService := CoNewService.Create(lMessage, lChannel);
a:=2;
b:=3;
for i:=1 to 3 do begin
c:=lService.Sum(a, b);
Writeln('Result: ', c);
end;
finally
lChannel.Free;
lMessage.Free;
end;
except
on e: Exception do
Write('Error trying to access the server: '+e.Message);
end;
end.

-> An exception “No Connection Available” occurs in TROTransportChannel.Dispatch() in “uROClient”.

P.S: The Sum() function is called and the result is even shown but then it hangs…

Thx & Cheers,
R.

Hello,
Thanks,
The issue was logged as #53463.
As a workaround please deactivate channel before calling remote method.

for i:=1 to 3 do
begin
lChannel.Active := false;
c:=lService.Sum(a, b);
Writeln('Result: ', c);
end;