This action will send the data to the network object. The data is encoded using the Python
pickle module.
If you are attempting to use the network object to communicate with a non-Python based application, then use the
<network>.sendRaw command to send raw unpickled data.
This command will trigger a
viz.NETWORK_EVENT on the receiving computer. A
viz.NetworkEvent object is passed to the event callback with the following attributes:
sender | The name of the computer that sent the message. |
address | The IP address of the computer that sent the message. |
port | The port number the message was received on. |
data | A tuple containing the positional data specified through the *args parameter. |
<keyword> | The value of the specified keyword argument from the **kwargs parameter |
network = viz.addNetwork('localhost')
def onKeyDown(key):
if key == ' ':
network.send(1,2,3,foo=4,bar=5)
viz.callback(viz.KEYDOWN_EVENT,onKeyDown)
def onNetwork(e):
print('Positional data:',e.data)
print(e.foo,e.bar)
viz.callback(viz.NETWORK_EVENT,onNetwork)