Skip to content

tcpCli how to get a reply? #2

@homuraLan

Description

@homuraLan

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions