0

I'm making python binds for Blackmagic's Ethernet Control Protocol ( as documented in https://documents.blackmagicdesign.com/UserManuals/HyperDeckManual.pdf?_v=1528269592000 , page 60). Simple socket connection seems to fail however, because every commands gets rejected with the server's greeting.

This protocol documents how software can communicate with certain blackmagic devices, in this case, Blackmagic's hyperdeck, the device runs a TCP server constantly listening on port 9993, on cmd I can simply telnet to it and issue commands, you'd it expect it to be as straightforward in python, however every command gets ignored for the server's greeting message, the device's information. I have been doing socket's for at least 3 months now and i've tried several methods of code, and all seem to fail.

For the most trivial test i've used:

import socket

HOST = "device's ip"
PORT = 9993        

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
s.sendall(b'play')
data = s.recv(1024)

print(data)

and a modified version to try to repeat the command:

import socket
import time

HOST = "device's ip"
PORT = 9993        

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
s.sendall(b'play')
data = s.recv(1024)
time.sleep(2)
s.sendall(b'play')

It should start video playback, as documented, and as occurs when I issue the command thru telnet, however the command is completely ignored and data always equals to: b'500 connection info:\r\nprotocol version: 1.9\r\nmodel: HyperDeck Studio Mini\r\n\r\n' , the server's greeting message in byte form, it should instead be 200 ok or some sort of error / acknowledged message, as documented.

This is incredibly annoying and i've thought of using subprocess and issuing commands thru cmd as an alternative, but something tells me there's an easier workaround.

Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
hiperbolt
  • 184
  • 2
  • 3
  • 11
  • https://stackoverflow.com/questions/34002137/socket-issues-in-python I believe this might have something to do with it,as in the server is constantly streaming the greeting message. I'm not sure tho – hiperbolt Jul 18 '19 at 23:07
  • 2
    It clearly states in the document: *The HyperDeck protocol is a line oriented text protocol. Lines from the server will be separated by an ascii CR LF sequence. Messages from the client may be separated by LF or CR LF.* So `s.sendall(b'play')` won't work, you need `s.sendall(b'play\n');` or `s.sendall(b'play\r\n')`; – President James K. Polk Jul 18 '19 at 23:57
  • You're absolutely right @JamesKPolk, if you'd like, rephrase that in an answer and i'll mark it correct – hiperbolt Jul 19 '19 at 09:39

0 Answers0