XAsyncSockets icon indicating copy to clipboard operation
XAsyncSockets copied to clipboard

tcpCli how to get a reply?

Open homuraLan opened this issue 3 years ago • 0 comments

I modified it(tcpCli.py):

countClosed = 0

pool    = XAsyncSocketsPool()
srvAddr = ('192.168.0.190', 8090)

for i in range(1) :
    cli = XAsyncTCPClient.Create(pool, srvAddr,5,4096,4096,False)
    if cli :
        print("Client %s created" % (i+1))
        cli.OnFailsToConnect = _onTCPClientFailsToConnect
        cli.OnConnected      = _onTCPClientConnected
        cli.OnClosed         = _onTCPClientClosed
    else :
        print("Error to create client %s..." % (i+1))

pool.AsyncWaitEvents(threadsCount=1)
time.sleep(7)
pool.StopWaitEvents()

Program output:

Client 1 created
On TCP Client Connected
On TCP Client Data Sent (test)

When I send a message to it, the program outputs: 1) On TCP Client Closed (error) How should I configure to receive information circularly, and whether there is automatic reconnection function Looking forward to your reply, thank you

homuraLan avatar Jul 22 '22 04:07 homuraLan