How to disconnect TCP client connection?

Hi I am working with W7500S2E-R1 module setting it as TCP/IP client. After successful TCP/IP establishment and data transfer i need to disconnect from the server. Is there any way the module disconnect the TCP connection? I tried an indirect way by following steps.

  1. Come out of Data mode and enter Command mode by passing “+++” in the serial port
  2. Send the AT command “AT+C1_IT=1” - inactive time as 1 ms.
  3. Send the AT command “AT+RECONTIME=55000” - reconnect time to be 55 secs.
  4. Send “AT+EXIT” to come out from Command mode.
  5. Wait for 1 - 5 secs to let the Modem disconnect from server by sending RST flag.

This way is working randomly. Please suggest other ideas to diconnect ??

Thanking you,
Praveena

The existing connections will be closed when entering “AT command mode”.
Whenever you want to disconnect, can you send +++ and then AT + EXIT?
If you can, it disconnect and reconnect the TCP connection.
However, AT + EXIT should be transmitted 1 second after +++ transmission.

Hi Becky,

Thank you so much for the reply.

I tested these steps you have mentioned in one of our server i am working. It works with Normal server and the Wiz Modem sends FIN packet to the server once it comes out of Data mode using the +++ command. But the same sequence is not working with the SSL protected servers i.e HTTTPS servers. The modem is not sending the FIN packet to server. What might be the reason? Please reply.

Thanks in advance.

W7500S2E-R1 does not support SSL connections. How did you connect?

Hi Becky,

We are working in an embedded environment where we use two scenarios HTTP connection without SSL - Http client and HTTP connection with SSL - Https client. We have our own HTTP application & SSL stack which uses the underlying TCP-IP connection which is where we use Wiz W7500S2E-R1 module. Both the HTTP and SSL stack are proven application and they are working fine for years with our previous Modem. The TCP-IP connection and Data transfer to and fro works fine with both the scenarios. Once confirmed all the data transfer has been done, when the application tries to close the active TCP-IP connection by coming out of data mode (by sending +++ with a time gap of 1 sec each before and after sending) , the first scenario HTTP connection without SSL - Http client is working as expected .Here the Wiz module sends a FIN packet to the remote host to disconnect the active connection. But in the second scenario HTTP connection with SSL - Https client, the Wiz modem doesn’t sends a FIN packet to the remote host. The remote host disconnects the connection after certain timeout.

I tried with setting the inactive timer to 1 ms and setting the reconnect time to 55 secs after coming out of the data mode and later going back to data mode (AT+EXIT). Later i expect the Wiz modem disconnects the connection. I tested with two different HTTPs connection i.e different servers (as TCP client). The result is, in one of the case, the Wiz modem sends a RST packet to the remote host in ~6 secs after entering data mode. In other case, nothing happened and the connection ended by remote host on timeout.

Hope i gave a clear and detailed story. Please help.

Thanks in advance.

Please reply for my question as this is really IMPORTANT for my current work.

Thanks,
Praveena