TCP Server Setup
Posted: Sun Nov 09, 2014 7:32 pm
I am trying to set up a TCP Server, without using AT, I can get the server connected and then it disconnects with timout error, I think it's because I haven't set the connect_callback function so the server desn't do anything when it connects, am I right?. Then, I'm trying to set up the function but i get a lot of undeclared and function type errors.
This is the TCP Server code:
struct espconn pTcpServer;
pTcpServer.type = ESPCONN_TCP;
pTcpServer.state = ESPCONN_NONE;
pTcpServer.proto.tcp->local_port = 2000;
espconn_regist_connectcb(&pTcpServer, myfunction); // I understand that this is the function that it will call when it connects?? this is where I get errors, can someone explain me how this would work?
// espconn_regist_recvcb(&pTcpServer, data_received);
espconn_accept(&pTcpServer);
espconn_regist_time(&pTcpServer, 180, 0);
The fact that there's barely any documentation and that the examples out there are too complex, it makes hard to create a new program step by step.
I wish in this forum we could have more examples/documentation on this steps (eg, tcp server examples, wifi examples, data send/receive examples, etc)
Any help will be appreciated.
Thanks
In this case a simple TCP Server example would help me a lot with this?
This is the TCP Server code:
struct espconn pTcpServer;
pTcpServer.type = ESPCONN_TCP;
pTcpServer.state = ESPCONN_NONE;
pTcpServer.proto.tcp->local_port = 2000;
espconn_regist_connectcb(&pTcpServer, myfunction); // I understand that this is the function that it will call when it connects?? this is where I get errors, can someone explain me how this would work?
// espconn_regist_recvcb(&pTcpServer, data_received);
espconn_accept(&pTcpServer);
espconn_regist_time(&pTcpServer, 180, 0);
The fact that there's barely any documentation and that the examples out there are too complex, it makes hard to create a new program step by step.
I wish in this forum we could have more examples/documentation on this steps (eg, tcp server examples, wifi examples, data send/receive examples, etc)
Any help will be appreciated.
Thanks
In this case a simple TCP Server example would help me a lot with this?