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

ESPAsyncTCPServer example needed #25

Closed
atrjt opened this issue Oct 4, 2016 · 3 comments
Closed

ESPAsyncTCPServer example needed #25

atrjt opened this issue Oct 4, 2016 · 3 comments
Labels

Comments

@atrjt
Copy link

atrjt commented Oct 4, 2016

I can't figure out how to code a simple multi client async TCP server using your library. I've looked at the WebServer code and can't figure it out. An example similar to the ESP8266 Arduino Telnet Server would be very helpful!

@NeilSpp
Copy link

NeilSpp commented Oct 6, 2016

void loop()
{
    if(millis() - previousTime > 200)
    {
        previousTime = millis();

        if(aClient1)//client already exists
        return;

        aClient1 = new AsyncClient();

        if(!aClient1)//could not allocate client
            return;

        aClient1->onConnect([](void * arg, AsyncClient * client) {

            client->write("tcp test string.");

            aClient1 = NULL;
            delete client;

        }, NULL);

        if(!aClient1->connect("192.168.0.100", 80))
        {
            AsyncClient * client = aClient1;
            aClient1 = NULL;
            delete client;
        }

        Serial.print("system_get_free_heap_size ");
        Serial.println(system_get_free_heap_size());
    }
}

This code can work, but after a period of time, system heap memory will continue to decline to 0.
How to correct close connect and free system heap memory?

@stale
Copy link

stale bot commented Sep 21, 2019

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Sep 21, 2019
@stale
Copy link

stale bot commented Oct 5, 2019

[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.

@stale stale bot closed this as completed Oct 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants