12345678910111213141516171819202122 |
- from modelverse import *
- init()
- login("test_service", "my_password")
- def fibonacci_service(port):
- def fibonacci(value):
- if value <= 2:
- return 1
- else:
- return fibonacci(value - 1) + fibonacci(value - 2)
- service_set(port, fibonacci(service_get(port)))
-
- service_register("fibonacci", fibonacci_service)
- while raw_input() != "STOP":
- # Stay active, as we shouldn't exit while the service is running!
- pass
- service_stop()
|