TCP client read

 1'''
 2TCP_client - TCP_client_read.py.
 3
 4This example demonstrates how to read data from server
 5
 6For other examples please check:
 7    https://github.com/WPC-Systems-Ltd/WPC_Stand-alone_Python_release/tree/main/examples
 8
 9Copyright (c) 2024 WPC Systems Ltd.
10All rights reserved.
11'''
12
13## WPC
14import pywpc
15
16## Paremeters setting
17host_ip = "192.168.5.108"   ## The server's hostname or IP address
18port = 3333                 ## The port used by the server
19read_bytes = 5
20
21## First you should open tcp server
22
23## Open TCP client
24pywpc.TCPClient_open(host_ip, port)
25
26## Read bytes from server
27data_read = pywpc.TCPClient_read(read_bytes)
28print(data_read)
29
30## Close TCP client
31pywpc.TCPClient_close()