Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tcpCli how to get a reply? #2

Open
homuraLan opened this issue Jul 22, 2022 · 0 comments
Open

tcpCli how to get a reply? #2

homuraLan opened this issue Jul 22, 2022 · 0 comments

Comments

@homuraLan
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant