| 1 | [wiki:WikiStart Orbit] > [wiki:Tutorial Tutorial] > Tutorial-1: Hello World Example |
| 2 | |
| 3 | The "Hello World" Experiment is simple. The script for this experiment is shown below. |
| 4 | |
| 5 | {{{ |
| 6 | |
| 7 | # |
| 8 | # Define nodes used in experiment |
| 9 | # |
| 10 | defNodes('sender', [1,1]) {|node| |
| 11 | node.image = nil # assume the right image to be on disk |
| 12 | |
| 13 | node.prototype("test:proto:sender", { |
| 14 | 'destinationHost' => '192.168.1.2', |
| 15 | 'packetSize' => 1024, |
| 16 | 'rate' => 300, |
| 17 | 'protocol' => 'udp' |
| 18 | }) |
| 19 | node.net.w0.mode = "managed" |
| 20 | } |
| 21 | |
| 22 | defNodes('receiver', [1,2]) {|node| |
| 23 | node.image = nil # assume the right image to be on disk |
| 24 | node.prototype("test:proto:receiver" , { |
| 25 | 'protocol' => 'udp' |
| 26 | }) |
| 27 | node.net.w0.mode = "master" |
| 28 | } |
| 29 | |
| 30 | allNodes.net.w0 { |w| |
| 31 | w.type = 'b' |
| 32 | w.essid = "helloworld" |
| 33 | w.ip = "%192.168.%x.%y" |
| 34 | } |
| 35 | |
| 36 | # |
| 37 | # Now, start the application |
| 38 | # |
| 39 | whenAllInstalled() {|node| |
| 40 | wait 30 |
| 41 | |
| 42 | allNodes.startApplications |
| 43 | wait 40 |
| 44 | |
| 45 | Experiment.done |
| 46 | } |
| 47 | }}} |
| 48 | |
| 49 | Figure 1. Script for "Hello World" Experiment |
| 50 | |
| 51 | |
| 52 | To understand the details of the script, go to [wiki:Tutorial/UnderstandingHelloWorld Understanding the Hello World Script] |