9 class PingPongTask < MSG::Task
13 #Has No Role, Since Its The Task Class ( Created from C ) tht will be called ,
14 # and any instruction here will be ignored
25 class Sender < MSG::Process
28 MSG::info("Hello from Sender")
30 MSG::info("Host count :" + hostCount.to_s)
33 for i in 0..hostCount-1
35 mailboxes<< MSG::Host.getByName(args[i]).name
37 # FIXME Handel Exceptions
40 for i in 0..hostCount-1
41 time = MSG.getClock.to_s # to send as a data >> must be a string
42 MSG::info("sender time :"+time.to_s)
43 task = PingPongTask.new("PingTask",10000,2000)
45 p "mailboxe >>> "+ mailboxes[i]
46 task.send(mailboxes[i])
49 MSG::info("GoodBye !!!")
59 class Receiver < MSG::Process
63 MSG::info("Hello from Receiver")
65 MSG::info("Try to get a task")
66 host = MSG::Host.getHostProcess(self)
67 task = PingPongTask.receive(host.name)
68 p "task name recevied : "+ task.name
69 p "data in the task :" + task.data
70 timeGot = MSG.getClock
72 MSG::info("Got at time: "+timeGot.to_s)
73 MSG::info("Was sent at time "+timeSent.to_s)
74 communicationTime = timeGot - time
75 MSG::info("Communication Time: "+communicationTime.to_s)
76 MSG::info("--- bw "+(100000000/communicationTime).to_s+" ----")
77 MSG::info("GoodBye !!!")
83 #################################################
85 #################################################
88 MSG.createEnvironment(ARGV[0])
89 MSG.deployApplication(ARGV[1])
91 MSG.createEnvironment("ping_pong_platform.xml")
92 MSG.deployApplication("ping_pong_deployment.xml")