Thanks for the pdf.
I can start the server now, but I still can't send and receive messages.
How do I use the tcp_accept anyway?
I tried something like
pcb = tcp_new();
tcp_bind(pcb, IP_ADDR_ANY, 80);
pcb = tcp_listen(pcb);
tcp_accept(pcb, ERR_OK);
while(1)
{
printf("\nI will send");
getchar();
tcp_write(pcb, "lalala", sizeof("lalala"), 0);
}
Well.... then my client can connect, but it won´t receive anything.
If I do something like:
tcp_accept(pcb, envia);
and create the function "envia" like this:
static err_t
envia(void *arg, struct tcp_pcb *pcb, err_t err)
{
int i;
for(i = 0; i < 5; i++)
{
printf("\nVou enviar");
getchar();
tcp_write(pcb, "lalala", sizeof("lalala"), 0);
}
return ERR_OK;
}
It will send the "lalala" five times when it reaches the "return".
But I want to use the tcp_write inside the main
How do I do that?
Thanks