Giter Site home page Giter Site logo

Comments (9)

anhvu100 avatar anhvu100 commented on September 25, 2024 1

FYI... I just modified the ESPAsyncTCP.cpp and add this code and now it works:
void AsyncServer::end(){
if(_pcb){
tcp_arg(_pcb, NULL);
tcp_sent(_pcb, NULL);
tcp_recv(_pcb, NULL);
tcp_err(_pcb, NULL);
tcp_poll(_pcb, NULL, 0);
tcp_accept(_pcb, NULL);
if ( tcp_close(_pcb)!=ERR_OK ) {
//cleanup all connections?
tcp_abort(_pcb);
}
//tcp_arg(_pcb, NULL);
//tcp_accept(_pcb, NULL);
_pcb = NULL;
}

from espasyncwebserver.

me-no-dev avatar me-no-dev commented on September 25, 2024

the server is not made to be able to change the port currently and what you try above is also not supported. Will look into it though

from espasyncwebserver.

anhvu100 avatar anhvu100 commented on September 25, 2024

I used the following code and it seems to work on the first time.
std::unique_ptr server;
server.reset(new AsyncWebServer(port));
When I call server.reset(new AsyncWebServer(port)) again in the loop() to change the listen port, the ESP crashes. Do you have any idea?

from espasyncwebserver.

me-no-dev avatar me-no-dev commented on September 25, 2024

@anhvu100 thanks! merged into AsyncTCP

from espasyncwebserver.

thbl avatar thbl commented on September 25, 2024

@me-no-dev @anhvu100 is this function removed ?
when i do
server.reset(new AsyncWebServer(port));
i get

note:   candidate expects 0 arguments, 1 provided
exit status 1
no matching function for call to 'AsyncWebServer::reset(AsyncWebServer*)'

from espasyncwebserver.

andrecortica avatar andrecortica commented on September 25, 2024

@ me-no-dev @ anhvu100 esta função foi removida?
quando
server.reset(new AsyncWebServer(port));
eu consigo

note:   candidate expects 0 arguments, 1 provided
exit status 1
no matching function for call to 'AsyncWebServer::reset(AsyncWebServer*)'

Did you manage to solve this problem?

from espasyncwebserver.

andykaaa avatar andykaaa commented on September 25, 2024

Yes!, .... ESP32

...
std::unique_ptr server;
...
void setup() {
...
server.reset(new AsyncWebServer(new_port));
...

from espasyncwebserver.

Account-Git avatar Account-Git commented on September 25, 2024

I have the same problem, but I cannot get the above suggestions to work.
What am I doing wrong?
When I add "std::unique_ptr server;" I get an "invalid use of template name" error.
And "server.reset(new AsyncWebServer(new_port));" returns the same error that andrecortica has above.
Could someone please explain this more clearly?

from espasyncwebserver.

andrecortica avatar andrecortica commented on September 25, 2024

Look this issues:
#1058

from espasyncwebserver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.