完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
Code: Select all
while (1) { //int err = send(sock, payload, strlen(payload), 0); // if (err < 0) { // ESP_LOGE(TAG, "Error occurred during sending: errno %d", errno); // break; // } int len = recv(sock, rx_buffer, sizeof(rx_buffer) - 1, 0); // Error occurred during receiving if (len < 0) { ESP_LOGE(TAG, "recv failed: errno %d", errno); break; } // Data received else { rx_buffer[len] = 0; // Null-terminate whatever we received and treat like a string ESP_LOGI(TAG, "Received %d bytes from %s:", len, host_ip); ESP_LOGI(TAG, "%s", rx_buffer); } vTaskDelay(2000 / porttiCK_PERIOD_MS); } 代码如下,当我使用tcp_client例程,并且把发送数据注释掉,再接收数据就很容易出现TCP数据粘包,求助 [22:43:18.320]收←◆[0;32mI (13311) example: 00 02 00 00 00 06 01 01 00 00 00 0A[0m [22:43:18.570]收←◆[0;32mI (13561) example: 00 02 00 00 00 06 01 01 00 00 00 0A[0m [22:43:18.822]收←◆[0;32mI (13811) example: 00 02 00 00 00 06 01 01 00 00 00 0A00 02 00 00 00 06 01 01 00 00 00 0A[0m [22:43:19.070]收←◆[0;32mI (14061) example: 00 02 00 00 00 06 01 01 00 00 00 0A[0m [22:43:19.322]收←◆[0;32mI (14311) example: 00 02 00 00 00 06 01 01 00 00 00 0A[0m |
|
相关推荐
|
|
只有小组成员才能发言,加入小组>>
142 浏览 1 评论
550浏览 6评论
460浏览 5评论
有没有办法在不使用混杂模式的情况下实现Wifi驱动程序接收缓冲区访问中断呢?
442浏览 5评论
444浏览 4评论
415浏览 4评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-23 01:03 , Processed in 0.817920 second(s), Total 73, Slave 57 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号