Network Receiver Component
The Network Receiver component facilitates the control of multi-touch scenarios through external devices or applications. It is able to receive network messages and so trigger actions on other components such as Media Players et al. The following image shows how the Network Receiver component basically works.
The Network Receiver component works in conjunction with various actions that use Network Message events as a trigger to control other components of the scenario. Basically, any device able to send network messages can be used. Learn more about Actions in this section. Learn more about Network Message actions in this section.
Working with network messages in Touch Creator is similar to how they are used in OS X Terminal or other command line interpreters. We recommend learning about network messages and the use of the Terminal application. Also, understanding the character of TCP connections might be useful to be more efficient with using network messages.
Creating Network Receiver Components
Drag and drop the Network Receiver component from the Library into the Stage and the corresponding component will be created in the Scene Manager. Place the Network Receiver component at its place within the hierarchy and then adjust any properties as required.
The Network Receiver component is very useful any time you wish to control your scenario by means of external devices or applications, for instance at trade fairs, shows or stage setups. The underlying network messaging is also expedient for the coordination of different devices and applications.
Note: The working of Network Sender and Network Receiver components look quite similar. The difference lies in the fact, that the Network Sender is being triggered by actions of other components, while the Network Receiver itself triggers other components.
The following example describes a simple scenario: you want to give your audience the option to start a Media Player from another touch device, for instance from an iPad. To do this, the iPad needs to be connected to the same network, and some application, for instance a web page, needs to be running on the iPad to send the required command to the Touch Player Mac.
Supposed the above requirements are met, here are the steps needed in Touch Creator to achieve the set goal.
- Add a Network Receiver component to your project by dragging the component onto the Stage. Its location on the Stage is of no relevance. Within the Scene Manager, we recommend locating the Network Receiver on top level right below a Scene.
- Go the Properties tab of the Network Receiver component and set the Port parameter in accord with the parameters set in the sending iPad device. This is where this component will listen to incoming network commands.
- Go to the Actions tab of this component and add a new action, e.g. a Play action. Now set the following parameters:
- Event: Select Network Message.
- Receiver: Name of the component that receives the action, e.g. Media Player 1.
- Parameter: Enter the exact string to receive in order to trigger the action.
- Publish the project to Touch Player
When the corresponding touch action is done on the iPad, the specified command is sent to the Mac's IP port. Touch Player is listening to this port, and when it receives the exact string, it will trigger the corresponding action, and Media Player 1 is started playing back the corresponding media.
You can include multiple actions with Network Message events for the Network Receiver in order to wait for different messages, so being able to trigger various actions of different components.
Like with Network Sender components, you can use multiple Network Receiver components to listen to incoming network commands. However, in most cases it suffices to use one such component, for it can be used from within all Scenes to wait for different messages which accordingly trigger different actions.
The only reason to use multiple Network Receiver components would be if it is technically required to send network messages through different IP ports.
Testing Network Messaging On the Same Mac
It is useful sometimes to test the working of Network Sender and Network Receiver components on one Mac. Please carry out the following steps to do that.
- Add both a Network Sender and a Network Receiver component to the project.
- Set the Server IP property for the Network Sender to "127.0.0.1".
- Make sure both Network Sender and Network Receiver components use the same port number.
- Make sure the message strings for both Network Sender and Network Receiver components are identical.
- Create a component, e.g. a Button, with an action to trigger the sending of a network command by the Network Sender.
- Create a component, e.g. a Media Player to receive the corresponding action from the Network Receiver.
- Create an action for Network Receiver triggered by the command from Network Sender that starts the Media Player.
If done properly, the clicking of the button should trigger the Network Sender to send the message. In turn, the Network Receiver on the same Mac (thus the 127.0.0.1 IP address) receives this messages and carries out the action that starts the Media Player.