
最近在使用STM32F746做网络开发,移植LwIP_TCP_Echo_Client客户端的程序,电脑端使用TCP/IP调试助手建立服务器,客户端板子上电初始化配置后,在调试助手能够看到客户端已经连上服务器,并收到字符串sending11111 tcp client message 0,但是在主函数中调用 tcp_echoclient_send函数,电脑端的调试助手收不到发送的数据,这中间出现了什么问题啊?还请搞过的朋友们指点啊,先谢谢了啊!~~~~~~~~客户端配置程序如下: void tcp_echoclient_connect(void) { struct ip_addr DestIPaddr; /* create new tcp pcb */ echoclient_pcb = tcp_new(); if (echoclient_pcb != NULL) { IP4_ADDR( &DestIPaddr, DEST_IP_ADDR0, DEST_IP_ADDR1, DEST_IP_ADDR2, DEST_IP_ADDR3 ); /* connect to destination address/port */ tcp_connect(echoclient_pcb,&DestIPaddr,DEST_PORT,tcp_echoclient_connected); } else { /* deallocate the pcb */ memp_free(MEMP_TCP_PCB, echoclient_pcb); #ifdef SERIAL_DEBUG printf("\n\r can not create tcp pcb"); #endif } } static err_t tcp_echoclient_connected(void *arg, struct tcp_pcb *tpcb, err_t err) { struct echoclient *es = NULL; if (err == ERR_OK) { /* allocate structure es to maintain tcp connection informations */ es = (struct echoclient *)mem_malloc(sizeof(struct echoclient)); if (es != NULL) { es->state = ES_CONNECTED; es->pcb = tpcb; sprintf((char*)data, "sending11111 tcp client message %d", (int)message_count); /* allocate pbuf */ es->p_tx = pbuf_alloc(PBUF_TRANSPORT, strlen((char*)data) , PBUF_POOL); if (es->p_tx) { /* copy data to pbuf */ pbuf_take(es->p_tx, (char*)data, strlen((char*)data)); /* pass newly allocated es structure as argument to tpcb */ tcp_arg(tpcb, es); /* initialize LwIP tcp_recv callback function */ tcp_recv(tpcb, tcp_echoclient_recv); /* initialize LwIP tcp_sent callback function */ tcp_sent(tpcb, tcp_echoclient_sent); /* initialize LwIP tcp_poll callback function */ tcp_poll(tpcb, tcp_echoclient_poll, 1); /* send data */ tcp_echoclient_send(tpcb,es); return ERR_OK; } } else { /* close connection */ tcp_echoclient_connection_close(tpcb, es); /* return memory allocation error */ return ERR_MEM; } } else { /* close connection */ tcp_echoclient_connection_close(tpcb, es); } return err; } |
ST的hal库有问题手头有STM32L4或STM32F7的帮忙测试DMA SD卡
STM32F756 DCMI +GC0308 Camera图片不正常
STM32F722RET6无法被JLINK/STLIN和IAR/KEIL识别
STM32F767以太网换PIN脚无数据
STM32F7 DSP库使用
没有人分享一下STM32F767 硬JPEG 编码解码吗
求STM32F777与FPGA通过FMC通信的参考设计
求STM32F7 1.15版本 固件库
STM32F746使用HAL库串口无法中断收数据
STM32F7xx AXIM & ITCM
评分
查看全部评分
建议使用网络抓包工具,看看发出的数据哪错了。
评分
查看全部评分