In the echo example we have this function that send again same packet so to echo back the data , i wanted to change it so to send a fixed data whatever the user sends so i changed this :
err = tcp_write(tpcb, p->payload, p->len, 1);
to this:
char* as="ki";
err = tcp_write(tpcb, as, 3, 1);
and when i run my application it doesn't echo back anything , why is that ?
Your problem is with the C code. Instead of
char * as = "ki"
use
char as[] = "ki"
or you can do pbuf alloc, maybe that can generate some memory for you.
es->p = pbuf_alloc(PBUF_TRANSPORT, strlen((char*)"ki") , PBUF_POOL);
pbuf_take(es->p, (char*)"ki", strlen("ki"));
Also, you should also check for the return condition, if tcp_write gives you anything else than ERR_OK then you should try again and try harder. I am using tcp write in POLL mechanism, but that is giving low throughput, I am getting comparatively better throughput when I use it in main while loop.