Can receive buffer (RX_RSR > 0) have data after SOCK_CLOSED?
Ethernet Chips
No replies yet. Be the first to reply.
Join the discussion.
Ethernet Chips
No replies yet. Be the first to reply.
Join the discussion.
Share projects and connect with makers.
Joined before the site update? first.
New to WIZnet Makers?
We sent a verification link to your address. Open it to activate your account, then log in.
Accounts from this email provider are reviewed by an administrator after verification. Approval usually takes one business day.
Already have an account?
Enter your email address. If it belongs to an account, we'll send a link to set a new password. Members who joined before the site update use this to set their password.
If an account uses that address, we sent a link to set a new password. The link works once and expires in 30 minutes.
Know your password?
Need an account?
RE: Can receive buffer (RX_RSR > 0) have data after SOCK_CLOSED?
by Eugeny ·
I would say it differently - your application should consider for data to come while socket is in established state (we talk about TCP), but when socket’s state is no more “established”, you must check receive buffer again once more to see if there’s some data still left you should get from there. As soon as you got remaining data from the RX buffer, you are free to reuse the socket. There’s no need to continuously check closed sockets for new data because closed sockets do not receive new data.
RE: Can receive buffer (RX_RSR > 0) have data after SOCK_CLOSED?
by lawrence WIZnet ·
hello, sofakng
If you do CLOSE command, the socket closed immediately.
But if you do DISCONNECT command, the socket wait for peer’ FIN.
It means if peer send data packet, w5500 can receive it until peer send FIN.
I am hard to understand what you want to do.
But I think It is helpful.
Thank you
lawrence
RE: Can receive buffer (RX_RSR > 0) have data after SOCK_CLOSED?
by sofakng ·
Thanks for the reply! Let me ask a different question…
Would this code work OK?
The idea is that a socket can be established, close_wait, closed, or any other status and still have data in the receive buffer. The only time I know a receive buffer is empty is when I re-create (LISTEN) on the socket.
Would the above code work OK in a loop or is that incorrect?
My application is a TCP server that receives small commands and executes them. If a client connects, sends a command, and then disconnects I still want to process the command which is why I care about data even on closed sockets.
RE: Can receive buffer (RX_RSR > 0) have data after SOCK_CLOSED?
by sofakng ·
Are there any examples of a multi-user (ie. multiple socket) TCP or Telnet server? Not the Arduino samples but an official Wiznet sample?
I’ve found other examples like a DNS client, DHCP client, and HTTP server, but nothing like a persistent Telnet server.
RE: RE: Can receive buffer (RX_RSR > 0) have data after SOCK_CLOSED?
by lawrence WIZnet ·
hello, sofakng
First, the code you show above, I think it would work. But I am not sure caz, it is hard to check all thing.
And I did not know you did not get the w5500 application code.
http://wizwiki.net/wiki/doku.php?id=products:w5500:driver
This link has loopback, dhcp, dnc application codes.
Thank you
lawrence