Open topic with navigation
<viztask>.waitNetworkRaw
Wait for a network event containing raw data
<viztask>.waitNetworkRaw( |
|
address = None |
port = None |
) |
|
address = None
IP address of sender, list of addresses, or None to allow any address
port = None
Port number, list of ports, or None to allow any port
Remarks
This command creates a Condition object that will wait for a raw network event from the specified address and port.
The yielded command returns a
viz.Data object with the following information about the condition:
events | A list of raw network events that were received |
Return Value
viztask.Condition object
Example
import viz
import vizact
import viztask
viz.go()
def WaitNetworkTask():
while True:
# Wait for raw network event from localhost
data = yield viztask.waitNetworkRaw(address='127.0.0.1')
# Process events
for e in data.events:
print(e.raw_data)
viztask.schedule( WaitNetworkTask() )
network = viz.addNetwork('localhost')
def SendRawData():
network.sendRaw('{} hello world'.format(viz.getFrameNumber()))
vizact.onkeydown(' ',SendRawData)
See also