[Mod] move test_client/test_server to examples folder
This commit is contained in:
parent
feef63adfa
commit
3b8b73b954
@ -20,15 +20,15 @@ class TestClient(RpcClient):
|
|||||||
"""
|
"""
|
||||||
Realize callable function
|
Realize callable function
|
||||||
"""
|
"""
|
||||||
print('client received topic:', topic, ', data:', data)
|
print(f"client received topic:{topic}, data:{data}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == "__main__":
|
||||||
req_address = 'tcp://localhost:2014'
|
req_address = "tcp://localhost:2014"
|
||||||
sub_address = 'tcp://localhost:0602'
|
sub_address = "tcp://localhost:0602"
|
||||||
|
|
||||||
tc = TestClient(req_address, sub_address)
|
tc = TestClient(req_address, sub_address)
|
||||||
tc.subscribeTopic('')
|
tc.subscribe_topic("")
|
||||||
tc.start()
|
tc.start()
|
||||||
|
|
||||||
while 1:
|
while 1:
|
@ -22,19 +22,19 @@ class TestServer(RpcServer):
|
|||||||
"""
|
"""
|
||||||
Test function
|
Test function
|
||||||
"""
|
"""
|
||||||
print('receiving: %s, %s' % (a, b))
|
print(f"receiving:{a} {b}")
|
||||||
return a + b
|
return a + b
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == "__main__":
|
||||||
rep_address = 'tcp://*:2014'
|
rep_address = "tcp://*:2014"
|
||||||
pub_address = 'tcp://*:0602'
|
pub_address = "tcp://*:0602"
|
||||||
|
|
||||||
ts = TestServer(rep_address, pub_address)
|
ts = TestServer(rep_address, pub_address)
|
||||||
ts.start()
|
ts.start()
|
||||||
|
|
||||||
while 1:
|
while 1:
|
||||||
content = 'current server time is %s' % time()
|
content = f"current server time is {time()}"
|
||||||
print(content)
|
print(content)
|
||||||
ts.publish('test', content)
|
ts.publish("test", content)
|
||||||
sleep(2)
|
sleep(2)
|
Loading…
Reference in New Issue
Block a user