lwip-users
[Top][All Lists]
Advanced

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

Re: Re: Re: [lwip-users] Ca n't send the data by Raw API


From: Sathya Thammanur
Subject: Re: Re: Re: [lwip-users] Ca n't send the data by Raw API
Date: Wed, 15 Feb 2006 07:50:01 -0800

Take a look at the doc/rawapi.txt document in the lwip installation area. This has all the functions that you would need for writing TCP and UDP applications.
Here is a snippet of a function that sends data.

  err_t err = ERR_OK;
  u16_t len;

  /* We cannot send more data than space available in the send
     buffer. */    
  if (tcp_sndbuf(pcb) < ps->left) {
    len = tcp_sndbuf(pcb);
  } else {
    len = ps->left;
  }

  if (len > 0) {
    err = tcp_write(pcb, ps->buf_p, len, 1);
  }

Sathya

On 2/14/06, 陳 小擁 <address@hidden> wrote:
Hi Sathya:
    thanks for your help. however, how can i check the tcp send buffer? which function can i use ? or i have to write it by myself ? someone have told me that if i want to use tcp_write , i have use tcp_output follow it .
>     temp_pcb = tcp_active_pcbs ;
>    err = tcp_write(temp_pcb , &abc[j] , sizeof(abc[j]),0) ;
>    tcp_output(temp_pcb) ;
is it right? thanks again !

 
You will need to keep checking the tcp send buffer for the amount of space left in the buffer before you call tcp_write. Keep calling a function that checks the tcp snd buf for space available and send accordingly.

hope this helps

Sathya

_______________________________________
YM - 離線訊息
就算你沒有上網,你的朋友仍可以留下訊息給你,當你上網時就能立即看到,任何說話都冇走失。
http://messenger.yahoo.com.hk


_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users



reply via email to

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