完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
HI已经发现了一些看起来像是bug的东西,我想让你告诉我是不是。当你使用伯克利API打开了一个客户端TCP套接字时,有一个连接到NETYPARS层的条目,它将它转发到低级TCPSocket和你可以在它上面使用的函数(TC)。PIPTTCP等)如果套接字在服务器端关闭,伯克利层将接收到“HoalLeablieCpDeSt连接”的调用,它将调用BSDSocket在调用TCPIPUTCPUBLAST之后进行Sttz断开连接。但是,如果应用程序调用“CeleSocket”,那么它将检测到TCP客户端SockEk。T与BSDATS.GT:= SktidEnter,因为套接字是在Sktz断开的,所以它不会称为“NETA PrimeSockCocket”。因此,伯克利和TCP层都可以,但是NETAYPRES将有一个条目“使用”,而它并不真正活跃。问题是:这个条目什么时候发布?-为什么不能跳过“否则”(Socket & Gt;BSDSTATE!= Sktz断开连接“”何时调用“CeleSoCKET”?我的意思是,现在我决定在那里使用一个“其他”,并且插座被正确关闭,但是我想知道这个附加条件的含义。
以上来自于百度翻译 以下为原文 Hi I've detected something that looks like a bug, and I'd like you to tell me whether it is or not. When you have a client TCP socket opened using the Berkeley API, there is a link to an entry of the NET_PRES layer, which forwards it to the low level TCP_SOCKET and the functions you can use on it (TCPIP_TCP_Close, etc). If the socket is closed at the server side, the Berkeley layer will receive a call to "HandlePossibleTCPDisconnection", which will take the BSD socket to SKT_DISCONNECTED after calling TCPIP_TCP_Abort. However, if after that your application calls "closesocket" then it will detect a TCP client socket with a bsdState >= SKT_LISTEN which won't call "NET_PRES_SocketClose" because of the socket being on SKT_DISCONNECTED. As a result, both Berkeley and TCP layer will be ok, but NET_PRES will have an entry "inUse" while it's not really active. And the questions: - When is this entry going to be released? - Why can't skip the "else if(socket->bsdState != SKT_DISCONNECTED)" check when calling "closesocket"? I mean, for now I've decided to use an "else" right there and the socket is closed properly, but I'd like to know what was the meaning of this additional condition. Regards |
|
相关推荐
4个回答
|
|
|
|
|
|
我在较早的版本(1.10)中发现了这个问题,我决定下载最新的一个(2.06)来检查这段源代码,这个代码没有改变(至少在这个问题上,没有关闭CouthSeCKET)和“HoudLeabeleCpp连接”,这并不意味着问题仍然存在。但是我仍然不知道这个条目是如何被释放的。复制问题的步骤很简单:用伯克利API打开一个TCP客户端套接字,直到连接建立为止。-从服务器端顺利地关闭套接字(关闭socket的所有步骤都是执行的)。ED)。在这个过程中,应该调用“HoalLeabeleCpDeSt连接”来指示套接字重置,而“BSDStand”应该转到Sktz断开连接。如果发生这种情况,你应该在这个层上耗尽“套接字”,因此,你不应该能够从伯克利层打开任何其他客户端套接字。我可能丢失了一些东西,因为这是一个非常常见的场景,但这就是我所发现的。显然,如果客户端是开始关闭过程的客户端,这不会发生。在这种情况下,所有调用都按预期进行,套接字完全关闭。
以上来自于百度翻译 以下为原文 I detected the problem on an earlier version (1.10) and I decided to download the latest one (2.06) to check this piece of source code, which hasn't changed (at least no change in both "closesocket" and "HandlePossibleTCPDisconnection" regarding the issue). It doesn't mean the problem's still there, but I still don't know how this entry is released. The steps to reproduce the problem are quite simple: - Open a TCP client socket from the controller using Berkeley API until the connection is established. - Close the socket from the server side smoothly (all the steps to close the socket are executed). During the process, the "HandlePossibleTCPDisconnection" should be called indicating a socket reset, and the "bsdState" should go to SKT_DISCONNECTED. - Call "closesocket", which won't call "NET_PRES_SocketClose", letting an entry at the NET_PRES layer with the "inUse" flag active, not available anymore. If this happens a number of times you should run out of "sockets" at this layer and, as a result, you shouldn't be able to open any other client socket from the Berkeley layer. I might be missing something, because that's a pretty common scenario, but that's what I've detected. Obviously, if the client is the one starting the close procedure, this doesn't happen. In this case, all the calls are made as expected and the socket gets fully closed top-down. Regards |
|
|
|
我在BSD客户机套接字中做了一些测试,当服务器要么RSTS连接,要么只是对它进行连接(在这种情况下,我必须从客户端调用特定的CockSocket())。在这两种情况下,NETYPURS套接字都被适当地关闭了。NETAYPRES中的一个简单调试函数列出了它的开放套接字。我同意在BSD中的额外调用ToNET-PrimeSoCKOutCuffe():BSDSTATE时关闭:= Sktz断开连接可能看起来有趣,并且可能被删除,但是无论如何,一旦代码从流/dGRAM套接字中退出I/OR,NETSIPExpSockCocket()被调用。无论如何,我已经使用了V2.06代码。如果我错过了什么,或者如果您的测试显示了不同的东西,请告诉我。
以上来自于百度翻译 以下为原文 I've done some tests with the BSD client sockets when the server either RSTs the connection or just FINs it (in which case I have to specifically call closesocket() from the client side). In both situations the NET_PRES socket is closed properly for me. A simple debug function in NET_PRES lists its open sockets. I agree that the extra call to NET_PRES_SocketClose() in BSD:closesocket() when bsdState != SKT_DISCONNECTED may look intriguing and could be probably removed, but anyway, once the code gets out of the if/else for the stream/dgram socket, NET_PRES_SocketClose() is called anyway. I've used the v2.06 code. Let me know if I've missed anything or if your tests show something different. |
|
|
|
好的,我已经看到了1.10(我使用的)和2.06的区别。BSD层有一个“TCPIpB-BSDG任务”来精确地处理这种情况。很高兴知道我已经调整了多少V1.10,以增加额外的功能,现在我只需要确保“NETAXPROSockCocket”从“CeleSocket”中被调用,即使套接字是在Sktz断开连接,作为一个简单的方法来解决这个问题。当我有时间的时候,我会切换到2。X,但不是现在。谢谢和问候。
以上来自于百度翻译 以下为原文 Ok, I've seen the difference between 1.10 (the one I'm using) and 2.06 regarding this. The BSD layer has a "TCPIP_BSD_Task" precisely to handle this situation. Good to know Considering how much I've tuned v1.10 in order to add extra features, for now I'll just make sure "NET_PRES_SocketClose" is called from "closesocket" even if the socket is in SKT_DISCONNECTED as a simple way to solve the problem. I'll switch to 2.x when I have some time, but not now. Thanks and regards |
|
|
|
只有小组成员才能发言,加入小组>>
5287 浏览 9 评论
2056 浏览 8 评论
1968 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3232 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2277 浏览 5 评论
820浏览 1评论
709浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
654浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
710浏览 0评论
607浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-1-13 03:41 , Processed in 0.910768 second(s), Total 52, Slave 46 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号