socket_protocol/_examples_/socket_protocol_client.py

17 lines
553 B
Python
Raw Normal View History

2021-01-11 17:46:05 +01:00
import sys
sys.path.append('../..')
2021-01-12 09:14:09 +01:00
2021-01-11 17:46:05 +01:00
import report
import socket_protocol
2021-01-12 09:14:09 +01:00
from socket_protocol_server import example_protocol, DID_ASC_TIME
2021-01-11 17:46:05 +01:00
import tcp_socket
import time
2021-01-12 09:14:09 +01:00
if __name__ == '__main__':
report.stdoutLoggingConfigure(log_name_lvl=[('root', 'INFO'), ])
c = tcp_socket.tcp_client_stp('127.0.0.1', 17017)
sp = example_protocol(c, channel_name='example_client')
sp.send(socket_protocol.SID_READ_REQUEST, DID_ASC_TIME, None)
print('The Client received: %s' % repr(sp.receive(socket_protocol.SID_READ_RESPONSE, 0).get_data()))