完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
用BSP里的STM32F107例子,增加TCPECHO线程并挂接netio进行测试;
netio的测试结果如下: D:iperf-2.0.5>win32-i386 -t 192.168.8.45 NETIO - Network Throughput Benchmark, Version 1.26 (C) 1997-2005 Kai Uwe Rommel TCP connection established. Packet size 1k bytes: 1097 KByte/s Tx, 4304 Byte/s Rx. Packet size 2k bytes: 1094 KByte/s Tx, 488 KByte/s Rx. Packet size 4k bytes: 1102 KByte/s Tx, 916 KByte/s Rx. Packet size 8k bytes: 1100 KByte/s Tx, 864 KByte/s Rx. Packet size 16k bytes: 1102 KByte/s Tx, 904 KByte/s Rx. Packet size 32k bytes: 1104 KByte/s Tx, 896 KByte/s Rx. Done. TCPECHO使用ipref进行测试,结果如下: D:iperf-2.0.5>iperf -c 192.168.8.45 --port 8000 ------------------------------------------------------------ Client connecting to 192.168.8.45, TCP port 8000 TCP window size: 64.0 KByte (default) ------------------------------------------------------------ [ 3] local 192.168.8.161 port 1700 connected with 192.168.8.45 port 8000 [ ID] Interval Transfer Bandwidth [ 3] 0.0-25.0 sec 192 KBytes 63.0 Kbits/sec TCPECHO的测试代码如下: char buf[1024]; void rt_tcp_echo_thread_entry(void *parameter) { int ret=0; int local_socket,echo_socket; struct sockaddr_in echo_addr,from; socklen_t addr_len = sizeof(struct sockaddr_in); echo_addr.sin_family = AF_INET; echo_addr.sin_addr.s_addr = htonl(INADDR_ANY); echo_addr.sin_port = htons(8000); rt_kprintf("Creat Echo socket thread start! "); while(1) { local_socket = socket(AF_INET, SOCK_STREAM,IPPROTO_TCP); if(INVALID_SOCKET == local_socket) { rt_kprintf("Creat Echo socket failed! "); rt_thread_delay(100); continue; } ret = bind(local_socket,(struct sockaddr*)&echo_addr, addr_len) ; if (SOCKET_ERROR == ret) { closesocket(local_socket); echo_socket = INVALID_SOCKET; rt_kprintf("local_socket bind port failed with %d ",ret); rt_thread_delay(100); continue ; } ret = listen(local_socket,5); if (SOCKET_ERROR == ret) { closesocket(local_socket); echo_socket = INVALID_SOCKET; rt_kprintf("local_socket listen port failed with %d ",ret); rt_thread_delay(100); continue ; } while(1) { echo_socket = accept(local_socket,(struct sockaddr*)&from,&addr_len); if(INVALID_SOCKET == echo_socket) { rt_thread_delay(100); continue; } while(1) { ret=recv(echo_socket, buf, sizeof(buf), 0); if(ret > 0) { send(echo_socket,buf,ret,0); } else { closesocket(echo_socket); break; } } } } } 线程挂载部分: echo_thread = rt_thread_create("tcpecho", rt_tcp_echo_thread_entry, RT_NULL, 2048, 3, 1); if(RT_NULL == echo_thread) { rt_kprintf("creat tcp echo failed "); } else { rt_thread_startup(echo_thread); } 与我之前测试的另外一块芯片,没有用操作系统,相比之下,差距太大了。 请问要想提高速率,该从哪些方面下手? 谢谢。 |
|
相关推荐
3个回答
|
|
|
|
|
|
TCPECHO使用ipref进行测试,结果如下:
D:iperf-2.0.5>iperf -c 192.168.8.45 --port 8000 ------------------------------------------------------------ Client connecting to 192.168.8.45, TCP port 8000 TCP window size: 64.0 KByte (default) ------------------------------------------------------------ [ 3] local 192.168.8.161 port 1700 connected with 192.168.8.45 port 8000 [ ID] Interval Transfer Bandwidth [ 3] 0.0-25.0 sec 192 KBytes 63.0 Kbits/sec 应该是比较两个ipref的结果才对。 一个是6Mbits/s 一个才63.0Kbits/sec |
|
|
|
你是说ipref的对比结果啊,这个好像是那个ack的问题;在netio中也可以见到,当包比较大时就没这个问题了。
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
583 浏览 0 评论
AI模型部署边缘设备的奇妙之旅:如何在边缘端部署OpenCV
2207 浏览 0 评论
tms320280021 adc采样波形,为什么adc采样频率上来波形就不好了?
1227 浏览 0 评论
1776 浏览 0 评论
1462 浏览 0 评论
74794 浏览 21 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-22 15:48 , Processed in 0.730093 second(s), Total 74, Slave 57 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号