need help

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

need help

M Shakiba

modified TCP Echo Server test; I could not send several packets

I modified the built-in template for LWIP tcp echo server code using zcu102 board in SDK, and I want to send a large amount of bytes when I receive anything. this is my sub code which I modified.

err_t recv_callback(void *arg, struct tcp_pcb *tpcb,
                               struct pbuf *p, err_t err)
  /* do not read the packet if we are not in ESTABLISHED state */
  if (!p) {
    tcp_recv(tpcb, NULL);
    return ERR_OK;
//  tpcb->snd_queuelen=100;
  /* indicate that the packet has been received */
  tcp_recved(tpcb, p->len);
  char* temp;
  /* echo back the payload */
  /* in this case, we assume that the payload is < TCP_SND_BUF */
  if (tcp_sndbuf(tpcb) > 2)//p->len)
//    err = tcp_write(tpcb, p->payload, p->len, 1);

    if(*(u8*)p->payload == 0x00)
      for(int i =0 ; i < 100 ; i++)
        err = tcp_write(tpcb, send_buf, tpcb->mss, 1);
        err = tcp_output(tpcb);
  } else
    xil_printf("no space in tcp_sndbuf\n\r");

  /* free the received pbuf */

  return ERR_OK;
when I sneaf packets by wireshark, I see that only 89 packets sent instead of 100.

if I increase mss and send bigger packets, it couldn't! sometimes it just send ack and then FIN ACK instead of sending what I want.

is there anything to help me?


Thank you in advance

lwip-users mailing list
[hidden email]