PYTHON - controlling Viz Engine

HUDis

New member
Dear All,
I am writing a Python application to control the Viz Engine. Can anyone help me with how to connect to the Viz Engine?
This is how I am currently doing it:

Python:
import socket

vizCommandPreffix = '0 #vizrt command'
vizCommandSuffix = '\0'

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_address = ('xxx.xxx.xxx.xxx', 6100)

sock.connect(server_address)
print("Connected")

sock.send(vizCommandPreffix.encode() + vizCommandSuffix.encode())

data = sock.recv(1024)
sock.close()
print ('Received',  repr(data.decode()))

After each command execution, the terminal returns messages:

JOINING SESSION............
LEAVING SESSION............

Is this the correct way to control the engine?
As far as I understand, my application connects to the Viz Engine, sends it a command, and then closes the connection.
Should I continue doing it this way, or should I maintain the connection throughout the entire runtime of my application?
 
Last edited:
Back
Top