完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我正在运行“berkeley_tcp_server”演示的修改版本,当我断开以太网电缆时,它没有检测到断开。当我刚开始启动系统时,一切正常,但当我拔掉并重新插入以太网电缆时,我无法重新连接到电路板上。当我对recv()命令的代码进行调试时,没有返回任何断开连接的错误。当nu.ireshark检查重新连接尝试时,我没有看到来自Pic端的任何响应。有没有办法检测在Berkley代码中连接已经断开?有没有办法重启连接?
以上来自于百度翻译 以下为原文 I am running a modified version of the "berkeley_tcp_server" demo and when I disconnect the Ethernet cable it does not detect the disconnection. I am running with the following HARMony 1.7.1 MPLAB 3.35 PIC32MZ2048ECH144 The basic TCP code has not changed from the Berkeley demo with the exception of a command parser being added. When I initially start the system everything works fine, however when I unplug and re-plug the Ethernet cable I am unable to reconnect to the board. When I debug into the code to the recv() command is giving no error back that a disconnection has occurred. When use wireshark to examine the reconnection attempt I see no responses back from the Pic end of things. Is there a way to detect that the connection has gone down in the Berkley code? and Is there a way to reset the connection? |
|
相关推荐
6个回答
|
|
我想知道,在微芯片演示板上运行股票演示程序,它是否能正常工作?
以上来自于百度翻译 以下为原文 I wonder if when running a stock demo on a Microchip Demo board does it work as expected ? |
|
|
|
使用TCPIP_STACK_NetIsLin.()检查接口当前是否连接。在TCP级别,您不会收到任何通知(除非您打开KEEP ALIVE),因为TCP连接将永远保持打开,直到其中一部分关闭。在断开并重新连接ETH电缆之后,您是否直到能够ping板,或者仅仅是这个TCP套接字有问题?
以上来自于百度翻译 以下为原文 Use TCPIP_STACK_NetIsLinked() to check if an interface is currently connected or not. At the TCP level you won't receive any notification (unless you turn on KEEP ALIVE) because the TCP connection will stay open forever, until one part closes it. After disconnect and reconnect the ETH cable, are you still able to ping the board, for example, or is just this TCP socket that has issues? |
|
|
|
在重新连接电缆之后,我无法ping电路板。TCPIP_STACK_NetIsLin.()确实检测到了断开,但是,当我试图使用该信息时,发生了一件有趣的事情:当我在断开连接之后关闭我正在使用的套接字并恢复侦听/接受新连接时尽管网络电缆被拔掉插头,我还是立即得到了一个新的连接。在接受代码中,似乎有一个对NET_PRES_SocketIsConnected(hTCP)的调用,它启动了一切,即使在连接被移除之后,它仍然返回true。有没有办法在断开后重置网络状态?(也许回忆初始化和重置状态机,但我不知道这是否会拧紧其他东西。)2。环顾四周寻找生存,无法找到如何设置。(这听起来就像我想要的)我会在哪里找到设置?谢谢。
以上来自于百度翻译 以下为原文 I am unable to ping the board after the reconnecting the cable. TCPIP_STACK_NetIsLinked() does detect the disconnection but, an interesting thing happens when I attempt to use that information: When I close the socket that I was using after the disconnect and resume listening/accepting new connections I immediately get a new connection despite the network cable being unplugged. In the accept code there appears to be a call to NET_PRES_SocketIsConnected(hTCP) that kicks everything off, this is still returning true even after the connection is removed. 1. Is there a way to reset the network state after the disconnection? (Maybe recalling the initialize and resetting the state machine but I don't know if that will screw anything else up.) 2. Looked around for KEEP ALIVE and was unable to find how to set it. (this sounds like exactly what I want) where would I find that setting? Thanks. |
|
|
|
Keep Alive:您需要使用本机API:-连接BSD套接字之后,使用hTCP=TCPIP_BSD_Socket()来获得本机套接字。-使用该调用TCPIP_TCP_OptionsSet(hTCP,TCP_OP._KEEP_ALIVE,&keepAliveData);-其中填充TCP_OP._KEEP_ALIVE_DATA keepAliveData;对于网络接口重置,您可以使用TCPIP_STACK_NetDown/TCPIP_STACK_NetUp——尽管这对于控制单个套接字来说有点困难。更好的是,我们试着去理解正在发生的事情。你所说的很奇怪,至少1。因此,“接受”立即返回一个有效的插座号码,即使电缆断开连接?看起来NETPYPRES中插座关闭/断开不正确。您用什么来关闭/断开?2。你可以尝试相同的,但使用不同的端口/服务器后,您检测到断开连接?三。在电缆重新连接后你不能跳板是令人不安的。我从其他用户那里听到过这方面的报道,但不幸的是,我的测试未能揭示这种情况。你有一个连接到你的板的串行控制台吗?你在一个标准的PIC32 ETE板上运行?
以上来自于百度翻译 以下为原文 Keep Alive: you need to do that using the native API: - after having the BSD socket connected, use hTCP = TCPIP_BSD_Socket() to get the native socket. - with this one call TCPIP_TCP_OptionsSet(hTCP, TCP_OPTION_KEEP_ALIVE, &keepAliveData); - where TCP_OPTION_KEEP_ALIVE_DATA keepAliveData; is populated properly. For network interface reset you can use TCPIP_STACK_NetDown/TCPIP_STACK_NetUp - although this is kind of heavy for getting a single socket under control. Better we try to understand what's going on. What you're describing is weird, to say the least. 1. So "accept" returns immediately with a valid socket number even if the cable is disconnected? Looks like the the socket close/disconnect doesn't occur properly in NET_PRES. What exactly call do you use to close/disconnect? 2. Can you please try the same but using a different port/server after you detect the disconnect? 3. The fact that you cannot ping the board after the cable was reconnected is disturbing. I've heard reports about this from other users but unfortunately my tests fail to reveal this situation. Do you have a serial console connected to your board? You're running on a standard PIC32 ETH board? |
|
|
|
和声版本很古老,你能尝试一下新版本的和声吗?可能会对堆栈进行一些更新。
以上来自于百度翻译 以下为原文 The harmony version is quite old. Can you try with the newer versions of Harmony?? There could be some updates to the stack. |
|
|
|
我有类似的问题,我在论坛上发表了一篇关于它的文章:
以上来自于百度翻译 以下为原文 I had similar issues, and i created a post about it on this forum at: http://www.microchip.com/forums/m944270.aspx |
|
|
|
只有小组成员才能发言,加入小组>>
5327 浏览 9 评论
2076 浏览 8 评论
1982 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3254 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2294 浏览 5 评论
835浏览 1评论
733浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
674浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
729浏览 0评论
622浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-2-4 09:48 , Processed in 1.229564 second(s), Total 84, Slave 68 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号