⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 client.py

📁 MANTIS是由科罗拉多大学开发的传感器网络嵌入式操作系统。 这是mantis的0.9.5版本的源码。
💻 PY
字号:
# This file is part of MANTIS OS, Operating System# See http://mantis.cs.colorado.edu/## Copyright (C) 2003-2005 University of Colorado, Boulder## This program is free software; you can redistribute it and/or# modify it under the terms of the mos license (see file LICENSE)import sysfrom twisted.spread import pbfrom twisted.internet import reactorfrom twisted.python import util# Connect to the serverfactory = pb.PBClientFactory()reactor.connectTCP("localhost", 1529, factory)# Get our node idnode_id = sys.argv[1]# Since it could take a while to connect and get the object, getRootObject# returns a deferred object.  This is an object we can attach callbacks to# so that when a connection is eventually made it will be handled.  In the# meantime we don't have to block, we just start running.d = factory.getRootObject()d.addCallback(lambda object: object.callRemote("register", node_id))d.addErrback(lambda reason: 'error: '+str(reason.value))d.addCallback(util.println)d.addCallback(lambda _: reactor.stop())reactor.run()

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -