Help with C# TCP connection to Hyperdeck

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

Oscar Moreno

  • Posts: 29
  • Joined: Thu Apr 21, 2016 3:28 pm

Help with C# TCP connection to Hyperdeck

PostTue May 07, 2019 11:24 pm

So, I've been trying to get a TCP/IP client connection to our Hyperdeck Pro working but so far I have not been able to get it to work. It's funny because I was able to get a TCP connection to our VideoHub 20x20 working with no problem with this code but the same code does not work with the Hyperdeck. When I run it nothing happens. Any ideas anyone? Code below:

Code: Select all

...
...
...
using System.Net.Sockets;


        private void button29_Click(object sender, EventArgs e)
        {           
            hyperdeck_cmd("play");
        }

        private void hyperdeck_cmd(string cmdtxt)
        {
           // TCP connection vars...
           private TcpClient hdeckClient;
           string hdeckserver = "10.x.x.x";
           int hdeckPort = 9993;
   
            //New client object...
            hdeckClient = new TcpClient();
            hdeckClient.Connect(hdeckserver, hdeckPort);

             //...append carriage return and newline
            cmdtxt = cmdtxt + "\r\n";

             //...send stream
            int bytecount = System.Text.Encoding.ASCII.GetByteCount(cmdtxt);
            byte[] sendData = new byte[bytecount];
            sendData = System.Text.Encoding.ASCII.GetBytes(cmdtxt);
            NetworkStream stream = hdeckClient.GetStream();
            stream.Write(sendData, 0, sendData.Length);

            //...cleanup
            stream.Close();
            hdeckClient.Close();
        }


Offline

Cameron Nichols

Blackmagic Design

  • Posts: 443
  • Joined: Mon Sep 04, 2017 4:05 am

Re: Help with C# TCP connection to Hyperdeck

PostWed May 08, 2019 5:00 am

Hi Oscar,

I have run through your code with hyperdeck_cmd method unmodified (apart from setting IP address) and it works ok. The likely reasons for this issue are:
  • You have not enabled remote control
  • You have another client connected
If it's the latter, the HyperDeck Studio Pro limits 1 client connection and will remotely disconnect any further connections. The issue is that TcpClient does not automatically detect the disconnection. A potential workaround is after calling stream = hdeckClient.GetStream(), call stream.Read to dump out the header information received on connection:
Code: Select all
500 connection info:
protocol version: 1.8
model: HyperDeck Studio Pro
If the NetworkStream.Read() returns 0, then the connection has been remotely disconnected.

Regards
Cameron
Offline

Oscar Moreno

  • Posts: 29
  • Joined: Thu Apr 21, 2016 3:28 pm

Re: Help with C# TCP connection to Hyperdeck

PostWed May 08, 2019 3:01 pm

Cameron thanks for the prompt response.

Yeah it's returning 0 with the code below. As far as I can tell there is no other client connecting to the Hyperdeck. Question: Does the ATEM Software control use the TcpClient to control the Hyperdeck? Anyway to retrieve the IP or client name of the connected TcpClient...?

Code: Select all
...
...
...
using System.Net.Sockets;


        private void button29_Click(object sender, EventArgs e)
        {           
            hyperdeck_cmd("play");
        }

        private void hyperdeck_cmd(string cmdtxt)
        {
           // TCP connection vars...
           private TcpClient hdeckClient;
           string hdeckserver = "10.x.x.x";
           int hdeckPort = 9993;
   
            //New client object...
            hdeckClient = new TcpClient();
            hdeckClient.Connect(hdeckserver, hdeckPort);

             //...append carriage return and newline
            cmdtxt = cmdtxt + "\r\n";

             //...send stream
            int bytecount = System.Text.Encoding.ASCII.GetByteCount(cmdtxt);
            byte[] sendData = new byte[bytecount];
            sendData = System.Text.Encoding.ASCII.GetBytes(cmdtxt);
            NetworkStream stream = hdeckClient.GetStream();

            //...is it dropped?
            int ntdata = stream.Read(sendData, 0, sendData.Length);
            string msg = ntdata.ToString();
            MessageBox.Show(msg, "stream dump");

            stream.Write(sendData, 0, sendData.Length);

            //...cleanup
            stream.Close();
            hdeckClient.Close();
        }

Offline

Oscar Moreno

  • Posts: 29
  • Joined: Thu Apr 21, 2016 3:28 pm

Re: Help with C# TCP connection to Hyperdeck

PostWed May 08, 2019 5:17 pm

UPDATE . . .

OK I got it working but I had to remove the Hyperdeck from the ATEM's Hyperdeck configuration panel. I assume the ATEM software uses the TcpClient to control the hyperdeck...
Offline
User avatar

Xtreemtec

  • Posts: 5397
  • Joined: Wed Jan 02, 2013 11:48 am
  • Location: The Netherlands

Re: Help with C# TCP connection to Hyperdeck

PostMon May 13, 2019 12:18 pm

Offcoarse it does. That is the normal way that the Atem connects with the Hyperdeck. And as soon the BMD software is open / ip set for a hyperdeck in the Atem hardware. This will always take presence as soon as the hardware boots.
Daniel Wittenaar .:: Xtreemtec Media Productions ::. -= www.xtreemtec.nl =-
4K OBV Trailer, ATEM TVS HD, 4M/E Broadcast Studio 4K, Constelation 8K, Hyperdeck Studio 12G, Ursa Broadcast 4K, 4K fiber converters with Sony Control
Offline

Oscar Moreno

  • Posts: 29
  • Joined: Thu Apr 21, 2016 3:28 pm

Re: Help with C# TCP connection to Hyperdeck

PostTue May 14, 2019 4:37 pm

I really think it should have multiple client capability so that at least I could connect to it remotely without having to remove it from the ATEM software.
Offline
User avatar

Xtreemtec

  • Posts: 5397
  • Joined: Wed Jan 02, 2013 11:48 am
  • Location: The Netherlands

Re: Help with C# TCP connection to Hyperdeck

PostTue May 21, 2019 8:14 am

Would be nice.. But all depends on how it is set up in the firmware. Our fiber muxes also allow 1 connection at a time due too a limit on the hardware chip. :?
Daniel Wittenaar .:: Xtreemtec Media Productions ::. -= www.xtreemtec.nl =-
4K OBV Trailer, ATEM TVS HD, 4M/E Broadcast Studio 4K, Constelation 8K, Hyperdeck Studio 12G, Ursa Broadcast 4K, 4K fiber converters with Sony Control

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 14 guests