.net Library - StarDust.CasparCG.net

Hi didikunz,

Thanks for your suggestions.

In fact I do need the Disconnected-Event to alter the GUI and to send a warning message via network to a remote operator / controller. Perhaps this is - as you mentioned - a “timing”-problem. My server is not running on the localhost but is another machine in a (very small) network. Maybe the answer to the disconnect command doesn’t return in time while the socket is still open. This could be an explanation.

Regarding the error with the package I have absolutely no idea where this comes from. I tried using another .net version beside my usual 4.7.2. Nothing changed. Complete mystery to me…

Ingo

Hi again,

here an interesting new fact.
I tried to use the packages with .net 4.8 and get another error message when I try to connect. Obviously a file is missing (and my system doesn’t have a drive f:)
Maybe this could be a hint what goes wrong:

Quelle für "f:\dd\ndp\clr\src\BCL\system\runtimehandles.cs" wird gesucht. (No checksum.)
Die Datei "f:\dd\ndp\clr\src\BCL\system\runtimehandles.cs" ist nicht vorhanden.
"f:\dd\ndp\clr\src\BCL\system\runtimehandles.cs" wird in Skriptdokumenten gesucht...
"f:\dd\ndp\clr\src\BCL\system\runtimehandles.cs" wird in Projekten gesucht.
Die Datei wurde nicht in einem Projekt gefunden.
Debugger fordert den Benutzer zum Suchen der Datei auf: f:\dd\ndp\clr\src\BCL\system\runtimehandles.cs.
Der Benutzer hat im Dialogfeld "Quellcode suchen" auf "Abbrechen" geklickt. Die Einstellungen zum Debuggen von Quelldateien für die aktive Projektmappe wurden so geändert, dass der Benutzer nicht zum Suchen der Datei aufgefordert wird: f:\dd\ndp\clr\src\BCL\system\runtimehandles.cs.
Die Quelldatei "f:\dd\ndp\clr\src\BCL\system\runtimehandles.cs" wurde nicht gefunden.

What version of Visual Studio do you use? Is dotNetFX 4.8 supported with it? And what dotNew version does the StarDust lib support? Normally it’s best to use the same version in all project, if possible.

I’m using Visaul Studio 2019.
StarDust packages seem to be net461;netstandard2.0
Do you think that could be a problem?

By the way: I downloaded runtimehandles.cs from the MS site and bind it to my project, As result I am back to the previous error System.ComponentModel.Annotations

Ingo

OK.
I am now able to run the packages as well.
In fact there was another NuGet-Packet required to run the whole thing.
Installing NuGet-Package “System.ComponentModel.Annotations” helped to compile everything correctly.
However the Disconnect-Event won’t fire.

Ingo

Hi,

I just fix this problem for the disconnected event. It was a bug on the code. Thanks to report this issue. For the problem of data annotation I add the nuget reference for .net framework. Normally it is fix too.

Hi rom1,

Thanks very much. This works fine.

However there is a minor issue when I connect, disconnect and then connect again.
The “version”-poperty as well as the GetVersion-command show wrong information on the second or more reconnection (as you could see in my application status bar enclosed):

First connect:
connect1

Disconnect and second connect (GetVersion):
connect2

Disconnect and third connect (CasparDevice.Version):
connect3

Maybe you are able to find the reason for that as well.
THANKS!

Ingo

Hi rom1,

I encountered another problem.
When connecting to the server the first time, the ChannelUpdated event isn’t raised however the server received the INFO command.
But when I disconnect and then connect again the event is thrown twice.

[Event thrown] Channel Updated : 8
[Event thrown] Channel Updated : 8

It also happens when I manually call CasparDevice.GetInfo() after the first connect.
Maybe there is something wrong with the network cue or the network timing?

Sorry that I cause so many problems…

Ingo

Hi rom1,

I don’t want to bother but I fear I found another issue.
I tried to use AMCP and OSC in one application. Unfortunately I can’t get the connection established. I get the message

Ausnahme ausgelöst: "System.Net.Sockets.SocketException" in System.dll

whenever I try to connect the OSC Listener.

At first I thought it was my fault, so I downloaded your demo file.
To my surprise it didn’t work either. Same message and no information back from the server (version 2.3).

Maybe the reason for all the behaviour is the same. I suppose it’s somehow tcp socket related but I’m not smart enough to fix it myself. :neutral_face:

Maybe you could have a look at it if you found time.

Thanks beforehand.

Cheers
Ingo

Hi Ingo,

Do you configure the server to allow OSC, is it the good port where you tried to connect.

Regards.

Ingo,

Thanks for your remarks. I found the issue. I had a mistake with my async event awaiter. The problem is fixed.
I just publish an alpha nuget version. Please test with this version, to install check the option: Include prerelease in the nuget manager.

Regards

Hi Romaine,

Thanks for your work on that problem.
Unfortunately I have the same behaviour as before.

But I found out that it has to do with the way I communicate with my caspar server.
When I run server on localhost (127.0.0.1) I can get a clean connection (except for the GetVersion-command that leads to an error).

My application communicates with a the caspar server in a (small) network. When I try to connect to this server (in my case server IP: 192.168.1.149 / client IP 192.168.1.148) the AMPC-connection works (with GetVersion command) but the OSC-connection fails - again with Ausnahme ausgelöst: "System.Net.Sockets.SocketException" in System.dll

Same behaviour with your demo project.
I also tried to connect with both firewalls disabled (client and server). That makes no difference either.

Maybe there is still a problem with the tcp socket via network.

Ping from client to server:

C:\Users\david>ping 192.168.1.149

Ping wird ausgeführt für 192.168.1.149 mit 32 Bytes Daten:
Antwort von 192.168.1.149: Bytes=32 Zeit<1ms TTL=128
Antwort von 192.168.1.149: Bytes=32 Zeit<1ms TTL=128
Antwort von 192.168.1.149: Bytes=32 Zeit<1ms TTL=128
Antwort von 192.168.1.149: Bytes=32 Zeit<1ms TTL=128

Ping-Statistik für 192.168.1.149:
    Pakete: Gesendet = 4, Empfangen = 4, Verloren = 0
    (0% Verlust),
Ca. Zeitangaben in Millisek.:
    Minimum = 0ms, Maximum = 0ms, Mittelwert = 0ms

Thanks.
Ingo

Just to get all information complete:

casparconfig contains:

<osc>
  <default-port>6250</default-port>
  <predefined-clients>
    <predefined-client>
      <address>127.0.0.1</address>
      <port>5253</port>
    </predefined-client>
  </predefined-clients>
</osc>

And I try to setup communication on port 6250.

Ingo

You need to add a predefined client with your client IP 192.168.1.148.

Romaine,

that doesn’t make any difference.
I tried:

<osc>
  <default-port>6250</default-port>
  <predefined-clients>
    <predefined-client>
      <address>192.168.1.148</address>
      <port>6250</port>
    </predefined-client>
  </predefined-clients>
</osc>

with different ports.
The behaviour doesn’t change. Neither in your demo project. :neutral_face:

Ingo

And I get a new message every now and again when I try to connect AMPC to the remote server:

System.NullReferenceException
  HResult=0x80004003
  Nachricht = Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
  Quelle = StarDust.CasparCg.net.Device
  Stapelüberwachung:
   bei StarDust.CasparCG.net.Device.CasparDevice.OnUpdatedChannelInfo(InfoEventArgs e)
   bei StarDust.CasparCG.net.Device.CasparDevice.<GetInfoAsync>d__77.MoveNext()
   bei System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in f:\dd\ndp\clr\src\BCL\system\runtime\compilerservices\TaskAwaiter.cs: Zeile184

  Diese Ausnahme wurde ursprünglich von dieser Aufrufliste ausgelöst:
    StarDust.CasparCG.net.Device.CasparDevice.OnUpdatedChannelInfo(StarDust.CasparCG.net.AmcpProtocol.InfoEventArgs)
    StarDust.CasparCG.net.Device.CasparDevice.GetInfoAsync()
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task) in TaskAwaiter.cs

This behaviour seems to have come with the alpha version of stardust library.

Ingo

In fact you need to instanciated a AMCP connection first And after you can connect on the default port.
If you don’t need the amcp connection you need to add your client ip adress on predefined client.

Do you try with the demo osc project ?

Other question do you have a firewall on your server that can block the port of OSC ? What is your actual Caspar CG Server version ?

Hi Romaine,

Thanks for your answer.
My application connects to the server via AMPC first. When the “ConnectionChanged” event is thrown with the parameter “Connected” I establish the OSC Listener.
I’m using server 2.3.0.
I also tried with your demo project. It behaves the same (localhost works / remote host doesn’t).

Ingo

P.S.: Would it be helpful to send you a lean version of my project?

Add firewall exception

Hi rrebuffo,

I disabled firewall on both server and client for testing.

Ingo