完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,我一直在尝试找到这个问题的答案,但是没有乐趣,希望解决的办法是我忽略的。这个问题只发生在我没有网络连接的时候。我的PIC32 MX尝试用TeCPPIPTCPPclipse打开函数连接到网络上的另一个设备。它被分配给套接字,它的状态变成TCPIPpTCPYSTATEY-clitNo.WItiTY连接。套接字包上的TCPIpMaCMAKPKTYFRAGEL排队标志是SATAS,套接字从不连接到网络I,然后使用TCPIPPUTCPY关闭功能关闭套接字,除了分组存储器W以外,所有的内存都被释放了。HICH大约是200字节。如果我尝试了足够的连接,堆最终会用完,并且我不能再做任何其他的TCP连接。我发现内存不被释放的原因是因为TCPIpMaCypKtfFraveQualdBayes标志。在TXSKTFLeLoCKEDV4PKT函数中的一条逻辑声明它将被释放,但是这个确认永远不会到来。我发现这2个方法是,如果PIC32 MX没有连接到网络,或者手动删除TCPIPSIMACYPKPKTFLAG队列,则不尝试连接。关闭Socket之前的d标志。但是,如果网络连接不够好,我的代码在网络瘫痪时尝试连接,我想用一种干净的方式释放不依赖于解决方案功能的资源。有人以前遇到过这种情况吗?因为我没有发现任何与这个问题有关的东西,我猜我已经错过了一些显而易见的东西。任何帮助都会被赏识的。我用的是V109的和声。谢谢,保罗。
以上来自于百度翻译 以下为原文 Hi, I've been trying to find an answer to this problem but have had no joy and hope the solution is something I've overlooked. This problem only occurs when I have no network connection. My pic32MX is trying to connect to another device on the network using the TCPIP_TCP_ClientOpen function. The memory is allocated to the socket and its state becomes TCPIP_TCP_STATE_CLIENT_WAIT_CONNECT The TCPIP_MAC_PKT_FLAG_QUEUED flag on the socket packet is set As the socket never connects to the network I then close the socket using the TCPIP_TCP_Close function All memory is freed except for the packet memory, which is roughly 200 bytes. If I attempt enough connections the heap eventually becomes used up and I can no longer make any further TCP connections. The reason I found for the memory not being freed is due to the TCPIP_MAC_PKT_FLAG_QUEUED flag. A piece of logic in the _TxSktFreeLockedV4Pkt function states it will be freed by the acknowledge, but this acknowledge never comes. The 2 ways I've found round this is either not to attempt a connection if the pic32MX is not connected to the network, or manually removing the TCPIP_MAC_PKT_FLAG_QUEUED flag prior to closing the socket. However if the network connection is poor enough that my code does try a connection when the network is down I would like a clean way to free up the resources that doesn't rely on a workaround function. Has anyone come up against this before? As I haven't found anything related to this problem my guess is I've missed something obvious. Any help would be appreciated. I'm using a v1_09 of HARMony. Thanks, Paul |
|
相关推荐
14个回答
|
|
可能是分组由ARP排队以获得网关的MAC地址。但是默认情况下ARP超时很长。你可以尝试使用一个小超时,看看这是否解决了你的问题。我会尝试去看它并检测到底发生了什么。这发生在没有网络电缆插入,或在什么条件下?
以上来自于百度翻译 以下为原文 It may be that the packet is queued by ARP to obtain the MAC address of the gateway. But the ARP timeout is pretty long by default. You could try to use a small timeout and see if this solves your problem. I'll try to look into it and detect what really happens. This occurs with no network cable plugged in, or under what exact conditions? |
|
|
|
HiRunad,我连接到路由器,并有一个静态IP地址。我对网络上的另一个设备进行了几个成功的TCP呼叫。然后我从路由器中删除网络电缆,这样我就不再有网络连接,并尝试再次连接到设备。这时我可用的堆大小减少了208个字节,而且永远不会返回。我查看了ARP超时,唯一大的是“如果不在几秒钟内被引用,就要删除一个已解决的条目”,我把它减少到60。我又试了10分钟后,我仍然没有记忆回到堆里。谢谢你的帮助。
以上来自于百度翻译 以下为原文 Hi rainad, I connect to a router and have a static IP address. I make several successful TCP calls to another device on the network. I then remove the network cable from the router so that I no longer have a network connection and attempt to connect to the device again. This is when my available heap size reduces by 208 bytes and is never returned. I looked at the ARP timeouts and the only large one was 'Time-Out for a Solved Entry to be Removed if not Referenced in Seconds' which I reduced to 60. I then tried again and after 10 minutes I still didn't have the memory returned to the heap. Thanks for your help. |
|
|
|
如果连接已经建立,那么TCP套接字将重新尝试发送它的数据包并永远保持连接。不可能知道目标主机是离线的、断开的、路由器崩溃等。如果您希望在连接丢失时,套接字放弃,请保持生存。
以上来自于百度翻译 以下为原文 If the connection is already established, then the TCP socket will re-try to send its packets and stay connected for ever. It cannot possible know that the destination host is off line, disconnected, routers crashed, etc. along the way. Enable keep-alive if you want the socket to give up when the connection was lost. |
|
|
|
我给了一个Go,但它没有改变任何东西。我不相信TCP套接字正在尝试重新发送它的数据包,因为当我重新连接电缆时,没有消息被发送到外部设备。此外,在调用TCPIPUTCPPclipse打开时,函数TCPPCoSkStestSoCube接口返回false,所以我猜它知道没有连接。我假设包是排队的,因为没有网络连接,所以当重新建立连接时,可以发送包。然而,由于某种原因,该包不再被处理并被遗忘。
以上来自于百度翻译 以下为原文 I gave that a go, but it didn't change anything. I'm not convinced the TCP socket is trying to resend its packet, as when I reconnect the cable no message is sent to the external device. Also, the function _TcpSocketSetSourceInterface returns false when I call TCPIP_TCP_ClientOpen, so I guess it knows there is no connection. I assumed the packet was queued because there was no network connection, so that when the connection was re-established, the packet could be sent. However, for some reason, the packet is never processed again and is forgotten about. |
|
|
|
我确认当套接字打开并且没有网络连接时内存泄漏。我已经修复了代码。在即将发布的V2.05版本中添加修复程序已经有点晚了,但我会看看可以做些什么。谢谢您的发现和报告。
以上来自于百度翻译 以下为原文 I've confirmed that there's a memory leak when the socket is opened and there is no network connection. I've fixed the code. It's kind of late to include the fix in the coming v2.05 release but I'll see what can be done. Thank you for finding and reporting this. |
|
|
|
|
|
|
|
|
|
|
|
这是V1.09的一个版本。请试试看它是否修复了这个问题。P.S.我建议升级到最新的V2 Rev。
以上来自于百度翻译 以下为原文 Here's a version for v1.09. Please give it a try and see if it fixes the the issue for you. P.S. I'd recommend upgrading to latest v2 rev though. Attachment(s) tcp_v1.09_fix.c (197.49 KB) - downloaded 66 times |
|
|
|
|
|
|
|
|
|
|
|
这里是V2.04的更新版本。
以上来自于百度翻译 以下为原文 Here's the updated version for v2.04. Attachment(s) tcp_v2.04_fix.c (201.01 KB) - downloaded 77 times |
|
|
|
你介意把这个补丁替换成完整的文件吗?
以上来自于百度翻译 以下为原文 Would you mind giving the patch instead of the complete file? |
|
|
|
抱歉,延迟。您可以比较我提供的文件与V2.04发行版中的一个文件:在TyPCV4FLUHSH()函数中删除的一个行-*TCPSEnter()函数已经改变(大约行3629左右)。
以上来自于百度翻译 以下为原文 Sorry for the delay. You can compare the file I provided with the one from the v2.04 distribution: - one line removed in the _TCPv4Flush() function - _TcpSend() function has changed (around line #3629 or so). |
|
|
|
我试过了,但是似乎有很多无关的变化,比如标签更改。另一方面,我希望看到一个标准的格式正确的代码。而且,如果每个都应该有一个卷曲的支撑。
以上来自于百度翻译 以下为原文 I tried, but there seemed to be a ton of unrelated changes, like tab changes. A side note, I'd like to see properly formatted code to a single standard. Also, every if should have a curly brace. |
|
|
|
只有小组成员才能发言,加入小组>>
4832 浏览 9 评论
1834 浏览 8 评论
1753 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
2963 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2063 浏览 5 评论
466浏览 1评论
1117浏览 1评论
236浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
371浏览 0评论
267浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-5-2 00:09 , Processed in 0.964156 second(s), Total 89, Slave 71 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号