25 lines
526 B
Python
25 lines
526 B
Python
import asyncio
|
|
|
|
|
|
async def tcp_echo_client(message):
|
|
reader, writer = await asyncio.open_connection('server', 7072)
|
|
print("Connected")
|
|
|
|
lines = [
|
|
"displayattr .*\n".encode(),
|
|
"inform on\n".encode(),
|
|
]
|
|
writer.writelines(lines)
|
|
|
|
while True:
|
|
data = await reader.readline()
|
|
data = data.decode()
|
|
print("Received line", data)
|
|
|
|
|
|
#asyncio.run(tcp_echo_client('Hello World!'))
|
|
|
|
loop = asyncio.get_event_loop()
|
|
loop.run_until_complete(tcp_echo_client("bla"))
|
|
loop.close()
|