コード例 #1
0
ファイル: ping.py プロジェクト: dccmx/stpclient-py
def main():
    host = sys.argv[1]
    port = int(sys.argv[2])
    if len(sys.argv) > 3:
        count = int(sys.argv[3])
    else:
        count = 1
    client = Client(host, port, timeout=1)
    for i in range(count):
        try:
            print client.call('ping').argv
        except:
            logging.exception('')
            client.close()
        time.sleep(0.5)
コード例 #2
0
ファイル: test_ping.py プロジェクト: dccmx/stpclient-py
 def test_connect(self):
     from stpclient import Client
     client = Client('localhost', 9999, timeout=1)
     assert not client.closed
     client.close()
     assert client.closed