| 1 | [wiki:WikiStart Orbit] > [wiki:OTG OTG] > [wiki:Documentation/OTG/ScriptsRepository Scripts Repository] > UDP/TCP Unicast |
| 2 | |
| 3 | {{{ |
| 4 | |
| 5 | Experiment.name = "tutorial-1a" |
| 6 | Experiment.project = "orbit:tutorial" |
| 7 | |
| 8 | # |
| 9 | # Define nodes used in experiment |
| 10 | # |
| 11 | defNodes('sender', [1,2]) {|node| |
| 12 | node.image = nil # assume the right image to be on disk |
| 13 | |
| 14 | node.prototype("test:proto:sender", { |
| 15 | 'destinationHost' => '192.168.1.1', |
| 16 | 'packetSize' => 1024, |
| 17 | 'rate' => 300, |
| 18 | 'protocol' => 'udp' |
| 19 | }) |
| 20 | node.net.w0.mode = "master" |
| 21 | } |
| 22 | |
| 23 | defNodes('receiver', [1,1]) {|node| |
| 24 | node.image = nil # assume the right image to be on disk |
| 25 | node.prototype("test:proto:receiver" , { |
| 26 | 'protocol' => 'udp' |
| 27 | }) |
| 28 | node.net.w0.mode = "managed" |
| 29 | } |
| 30 | |
| 31 | allNodes.net.w0 { |w| |
| 32 | w.type = 'b' |
| 33 | w.essid = "helloworld" |
| 34 | w.ip = "%192.168.%x.%y" |
| 35 | } |
| 36 | |
| 37 | # |
| 38 | # Now, start the application |
| 39 | # |
| 40 | whenAllInstalled() {|node| |
| 41 | wait 30 |
| 42 | |
| 43 | allNodes.startApplications |
| 44 | wait 40 |
| 45 | |
| 46 | Experiment.done |
| 47 | } |
| 48 | |
| 49 | |
| 50 | }}} |