IGT vtkMRMLIGTLConnectorNode best way to know how long to wait for connection and node access?

Operating system: Ubuntu16.04.4
Slicer version: 4.8.1

navigationHostName=‘fusion’
navigationPortNumber=‘18944’
connectorNodeNav = slicer.vtkMRMLIGTLConnectorNode()
connectorNodeNav.SetTypeClient(navigationHostName,int(navigationPortNumber))
slicer.mrmlScene.AddNode(connectorNodeNav)
connectorNodeNav.Start()

print “NumberOfIncomingMRMLNodes=”, connectorNodeNav.GetNumberOfIncomingMRMLNodes()

How long to wait before I get correct values?
Line above yields 0 in interpreter if I paste code above in one go and 3 as expected if I wait a bit before pasting the last line. This code in a module always yields zero. Advice? Block on something?

1 Like

Connections are managed in background threads. If you want to know when a client is connected then add an observer to the connector node.