This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

lwip echoserver

請教我參考st網站,利用echotool驗証

(TOOL: www.st.com/.../en.DM00026013.pdf)

C:\>echotool 192.168.30.15 /p tcp /r 7 /n 5 /t 2 /d aabbccddeeff

Hostname 192.168.30.15 resolved as 192.168.30.15

Reply from 192.168.30.15:7, time 0 ms OK

已經可以通,但小弟trace了好久還是debug不到資料

程式在 static err_t tcp_echoserver_recv(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err),下的

else if (es->state == ES_RECEIVED)
{
/* more data received from client and previous data has been already sent*/
if(es->p == NULL)

在pcb payload還是看不到丟過來的"aabbccddeeff"資料

請教各位該怎麼把資料抓出來, 謝謝! 

  • static err_t tcp_echoserver_recv(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err)  
    2.{  
    3.  struct tcp_echoserver_struct *es;  
    4.  err_t ret_err;  
    5.  
    6.  LWIP_ASSERT("arg != NULL",arg != NULL);  
    7.    
    8.  es = (struct tcp_echoserver_struct *)arg;  
    9.  
    10.  if (p == NULL)  
    11.  {  
    12.   //如果接收到空的帧,则释放连接  
    13.   ...  
    14.  }     
    15.  else if(err != ERR_OK)  
    16.  {  
    17.   //接收到一个非空的帧,但可能某些原因出错,导致返回值不为ERR_OK,故在此释放缓存  
    18.   ...  
    19.  }  
    20.  else if(es->state == ES_ACCEPTED)  
    21.  {  
    22.   //连接成功,在这里需要设置sent回调函数  
    23.   ...  
    24.  }  
    25.  else if (es->state == ES_RECEIVED)  
    26.  {  
    27.   //从客户端收到数据  
    28.   ...  
    29.  }  
    30.  else  
    31.  {  
    32.   //当连接关闭时,还收到了数据  
    33.   ...  
    34.  
    35.  }  
    36.    
    37.  return ret_err;  
    38.}  
    

    _____________

    下面这个讲解的很好。不知道你是不是按照这个套路做的

    http://www.cnblogs.com/wodeyitian/archive/2011/07/04/2460217.html

  • 請問要如何控制連線socket數目,比如socket=10

    讀取這10 個socket資料?

    謝謝!