[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
|
||||
"""
|
||||
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:
|
@ -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)
|
Loading…
Reference in New Issue
Block a user