Lightstreamer / Lightstreamer-example-HelloWorld-adapter-dotnet

"Hello World" tutorial for Lightstreamer .NET Adapter API
Apache License 2.0
5 stars 3 forks source link

C# build yourself doesn't work #3

Closed keith-carr closed 3 months ago

keith-carr commented 3 months ago

Hello,

I've successfully got HTML client to connect to the HelloWorld example using the deploy.zip. So I'm confident I've configured the server correctly. I've been running the below example: Hello World\Deployment_DotNet_Core\c_sharp\HelloWorld_Remote_Adapter.cmd

However when I'm building the project myself using the DataAdapterLauncher.cs and HelloWorld.cs files provided, adding the NuGet package reference Lightstreamer.DotNetStandard.Adapters. Then the HTML client is unable to connect.

I can see that the Lightstreamer log files showing the interaction between the server and adaptor are different.

The log file running the precompiled hello world example adaptor file: Good Lightstreamer.log

The log file running my own build of the hello world example adaptor: Bad Lightstreamer.log

Crucially, in the good log, I can see the server actively telling me it is listening on 8080 which is what the HTML client is going to attempt to connect to. This isn't shown in the log file for my own compiled version.

I've even tried decompiling the precompiled example using dnSpy, the HelloWorld.cs file is identical and the real only difference is in the DataAdapterLauncher.cs file: dataProviderServer.NotifyStream = notifSocket.GetStream();

It seems in the version of the Lightstreamer.DotNetStandard.Adapters I'm using (latest at time of writing- 1.15.1) there is no NotifyStream property / field on the DataProviderServer class.

Thanks for any help you can offer Keith

Using Lightstreamer 7.4.2

java version "1.8.0_411" Java(TM) SE Runtime Environment (build 1.8.0_411-b09) Java HotSpot(TM) 64-Bit Server VM (build 25.411-b09, mixed mode)

.NET 8 IDE: VSCode Nuget package reference: Lightstreamer.DotNetStandard.Adapters 1.15.1

keith-carr commented 3 months ago

Nevermind, I had a light bulb moment and figured it out.

The XML provided for PROXY_HELLOWORLD has: 6662

As the NuGet version of Lightstreamer.DotNetStandard.Adapters DataProviderServer doesn't have a NotifyStream property /field I decided to try removing '6662' from the XML and re-running.

After removing this line, my own built code now works, the HTML client connects.

Hope this is helpful to anyone who tries to build this example in the future.

dario-weswit commented 3 months ago

Hello, This was a version mismatch. Before Server version 7.4, the connection of a Remote Data Adapter required two sockets and the configuration of two ports. Now, with 7.4 a single socket and a single port can also be configured, and this is obviously the new recommended configuration. As a consequence, the Remote SDK library was modified and the latest version works with a single port. Likewise, the examples on github were updated. Your first successful test must have been based on the previous version of the example and its deploy.zip, which were based on two ports. Then, when you tried with DataAdapterLauncher.cs, you must have taken it from the latest version of the example, which uses a single port. In this version of the example, the configuration on the Server has also changed, as reflected by adapters.xml in the new deploy.zip. By removing the 6662 port, you have actually done the update yourself. We acknowledge that changes of this kind are difficult to clarify and some details may be overlooked.