[Mod] move test_client/test_server to examples folder

This commit is contained in:
vn.py 2019-07-01 21:35:28 +08:00
parent feef63adfa
commit 3b8b73b954
2 changed files with 11 additions and 11 deletions

View File

@ -20,15 +20,15 @@ class TestClient(RpcClient):
"""
Realize callable function
"""
print('client received topic:', topic, ', data:', data)
print(f"client received topic:{topic}, data:{data}")
if __name__ == '__main__':
req_address = 'tcp://localhost:2014'
sub_address = 'tcp://localhost:0602'
if __name__ == "__main__":
req_address = "tcp://localhost:2014"
sub_address = "tcp://localhost:0602"
tc = TestClient(req_address, sub_address)
tc.subscribeTopic('')
tc.subscribe_topic("")
tc.start()
while 1:

View File

@ -22,19 +22,19 @@ class TestServer(RpcServer):
"""
Test function
"""
print('receiving: %s, %s' % (a, b))
print(f"receiving:{a} {b}")
return a + b
if __name__ == '__main__':
rep_address = 'tcp://*:2014'
pub_address = 'tcp://*:0602'
if __name__ == "__main__":
rep_address = "tcp://*:2014"
pub_address = "tcp://*:0602"
ts = TestServer(rep_address, pub_address)
ts.start()
while 1:
content = 'current server time is %s' % time()
content = f"current server time is {time()}"
print(content)
ts.publish('test', content)
ts.publish("test", content)
sleep(2)