lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] need help


From: M Shakiba
Subject: [lwip-users] need help
Date: Tue, 17 Sep 2019 15:07:40 +0200


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

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_close(tpcb);
    tcp_recv(tpcb, NULL);
    return ERR_OK;
  }
  tpcb->mss=100;
  tpcb->snd_buf=0xffff;
//  tpcb->snd_queuelen=100;
  tpcb->ssthresh=0xffff;
  //tpcb->unsent_oversize=tpcb->mss;
  /* 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++)
      {
        temp[0]=(char)i;
        send_buf=string_repeat(tpcb->mss,temp);
        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 */
  pbuf_free(p);

  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

reply via email to

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