Quick question

Hi guys,

have any tips to program server status in c#. I would like to create status light for server, but cent get exact solution, is there any hearbeat command in caspar, or maybe you can provide better solution?

You could create a simple OSC connection status indicator. If it’s connected and receiving a given message thet the light is on/green. If the OSC server is disconnected or the message is not received for a long period, the light is off/red.

I understand the way NRK handles it is with a PING command sent to the server with a interval. If no data is received after a couple of attempts, then it considers it down.

in visual basic dot net we write as below

Dim WithEvents caspardevice As New CasparDevice

 Private Sub caspardevice_ConnectionStatusChanged(sender As Object, e As Svt.Network.ConnectionEventArgs) Handles caspardevice.ConnectionStatusChanged
        If caspardevice.IsConnected = True Then
            cmdConnect.BackColor = Color.Green
        Else
            cmdConnect.BackColor = Color.Red
        End If
    End Sub

and basically you put this function in interval, ie each 5 sec execute this function or so?

No timer, no interval.
When you define “Dim WithEvents caspardevice As New CasparDevice” You get like this

CasparDevice caspar = new CasparDevice();
//connection commands
caspar.ConnectionStatusChanged += new EventHandler<ConnectionEventArgs>(ConnectionHandler);

private void ConnectionHandler(object target, ConnectionEventArgs e)
{
     light_status = e.Connected;
}

That’ what it looks like in C#. It’s an asynchronous event handler for the server connection status.

thanx all guys, will try this last solution