Where we have been asked to supply useful code examples we have taken a copy below to aid the understanding of the API interface.
Here's a quick function that demonstrates how to get the port for a device:
int32_t tuioPortForDevice(HTBDEVICE device) { int32_t port = 0; int32_t displaysHaveOwnHost = 0; bool success = TBApiGetSettingAsInt(0, "tuio displays have own host", &displaysHaveOwnHost); if (success && displaysHaveOwnHost) { success = TBApiGetSettingAsInt(device, "tuio port", &port); } else { success = TBApiGetSettingAsInt(0, "tuio port", &port); } if (!success || port == 0) { port = 3333; } return port; }
Also note that you can launch UPDD TUIO with command line arguments that override the port number so that UPDD settings aren't used. If this is the case then there's no way to get the port number using the UPDD API.