lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] where should I call tcp_accepted?


From: CHASE CHENG
Subject: [lwip-users] where should I call tcp_accepted?
Date: Fri, 10 May 2013 17:08:14 +0800

Hi,
I refered the flow of the page (http://lwip.wikia.com/wiki/Raw/TCP), which said that I should call tcp_accepted once an connection is accepted.
I added the tcp_accepted in my tcp_accept callback function, but it shows fail since pcb->state is already changed to ESTABLISHED.
I wondered where should I call tcp_accepted?
Regards,
Chase

Here is part of the code:
static err_t
netio_accept(void *arg, struct tcp_pcb *pcb, err_t err)
{
...
  tcp_accepted(pcb);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I tried to add tcp_accepted here.

  tcp_arg(pcb, ns);
  tcp_sent(pcb, netio_sent);
  tcp_recv(pcb, netio_recv);
  tcp_poll(pcb, netio_poll, 4); /* every 2 seconds */
  return ERR_OK;
}




void netio_init(void)
{
  struct tcp_pcb *pcb;
  int err;

  pcb = tcp_new();
  do{
err = tcp_bind(pcb, IP_ADDR_ANY, 18767);
tx_thread_sleep(500);
printf("tcp_bind status: %d\n", err);
  }while(err != ERR_OK);

  netio_closed = 0;
  pcb = tcp_listen(pcb);
  
  tcp_accept(pcb, netio_accept);
}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]