| | 1 | [wiki:WikiStart Orbit] > [wiki:OTG OTG] > [wiki:OTG/ScriptsRepository Scripts Repository] > UDP brocast Sender with RAW socket receiver |
| | 2 | |
| | 3 | {{{ |
| | 4 | xperiment.name = "tutorial-bcast" |
| | 5 | Experiment.project = "orbit:tutorial" |
| | 6 | |
| | 7 | # |
| | 8 | # Define nodes used in experiment |
| | 9 | # |
| | 10 | defNodes('sender', [1,2]) {|node| |
| | 11 | node.image = nil # assume the right image to be on disk |
| | 12 | |
| | 13 | node.prototype("test:proto:sender", { |
| | 14 | 'destinationHost' => '192.168.255.255', |
| | 15 | 'packetSize' => 1024, |
| | 16 | 'rate' => 300, |
| | 17 | 'protocol' => 'udp' , |
| | 18 | 'broadcast' => 'on' |
| | 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:raw_receiver" , { |
| | 26 | 'dstfilter' => '192.168.255.255', |
| | 27 | 'rxdev' => 'ath0', |
| | 28 | 'protocol' => 'raw_libmac' |
| | 29 | }) |
| | 30 | node.net.w0.mode = "managed" |
| | 31 | } |
| | 32 | |
| | 33 | allNodes.net.w0 { |w| |
| | 34 | w.type = 'b' |
| | 35 | w.essid = "helloworld" |
| | 36 | w.ip = "%192.168.%x.%y" |
| | 37 | } |
| | 38 | |
| | 39 | # |
| | 40 | # Now, start the application |
| | 41 | # |
| | 42 | whenAllInstalled() {|node| |
| | 43 | wait 30 |
| | 44 | |
| | 45 | allNodes.startApplications |
| | 46 | wait 40 |
| | 47 | |
| | 48 | Experiment.done |
| | 49 | } |
| | 50 | |
| | 51 | }}} |
| | 52 | |