WIZnet Developer Forum

Connection termination process problem!

Hello, I have got problem similar to [url][SOLVED] W5100 Sn_CR_DISCON Time], but in CLIENT mode.

Originally when all data is received (socket is not in ESTABLISHED mode any more) I was just using CLOSE command. But I found out that some network devices do not like it, they hung when I start next connection to them.

Thus, before closing, I unconditionally issue DISCON command. Now those network devices act properly, but I got problem in W5100.

Scenario: I connect using TCP/HTTP to remote server. I get data OK, when connection is no more established I issue DISCON command, wait until command reg is 0, then issue CLOSE command and wait until command reg is 0. I consider this transaction as closed.
Immediately I connect to the same server (to another HTTP resource on this server), writing 0xFF to IR register (clearing all status bits for the socket) before connecting and when waiting for connection establishment, I get timeout interrupt bit set (IR bit 3). I suspect that this is timeout from the DISCON command issued for another resource on this server in the past, and which communication I considered as already closed.

Thus
Question #1: what is the RIGHT WAY to “shut down” communication with server? Documentation does not much detail on it.
Question #2: how to ensure that I do not get anything (status, interrupt) from previously closed connection to the same network device? How do I know that status I get is related to CURRENT session, and not past session?

Copyright © 2017 WIZnet Co., Ltd. All Rights Reserved.