Networking
Networking Tests.
Assumptions
In docstring examples,
listens
callbacks are often omitted for clarity
Functions:
|
|
|
|
|
|
- test_node_to_node(node_params)[source]
Net_Node
s can directly send messages to each other withROUTER
/DEALER
pairs.>>> node_1 = Net_Node(id='a', router_port=5000) >>> node_2 = Net_Node(id='b', upstream='a', port=5000) >>> node_2.send('a', 'KEY', 'VALUE') >>> node_2.send('b', 'KEY', 'VALUE')
- test_multihop(node_params, station_params)[source]
Message
s can be routed through multipleStation
objects by using a list in theto
field# send message: # node_1 -> station_1 -> station_2 -> station_3 -> node_3 >>> station_1 = Station(id='station_1', listen_port=6000, pusher=True, push_port=6001, push_id='station_2') >>> station_2 = Station(id='station_2', listen_port=6001, pusher=True, push_port=6002, push_id='station_3',) >>> station_3 = Station(id='station_3', listen_port=6002) >>> node_1 = Net_Node(id='node_1', upstream='station_1', port=6000) >>> node_3 = Net_Node(id='node_3', upstream='station_3', port=6002) >>> node_1.send(key='KEY', value='VALUE', to=['station_1', 'station_2', 'station_3', 'node_3'])