# Gracefully closing the socket

**URL:** <https://forum.sierrawireless.com/t/gracefully-closing-the-socket/3594>\
**Category:** Open AT\
**Created:** [August 31, 2009, 8:36pm UTC](https://forum.sierrawireless.com/t/gracefully-closing-the-socket/3594 "2009-08-31T20:36:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MEIEngineer](https://avatars.discourse-cdn.com/v4/letter/m/779978/32.png) [@MEIEngineer](https://forum.sierrawireless.com/u/MEIEngineer)\
**Post date:** [August 31, 2009, 8:36pm UTC](https://forum.sierrawireless.com/t/gracefully-closing-the-socket/3594/1 "2009-08-31T20:36:45Z")

</div>

Hi,  
I am working with the wavecom radio: 657d09gg.Q24PL001 in order to connect to a server for sending and receiving data.  
I am having difficulty switching back to the AT command mode from the data mode. The way it is working right now is when the server closes its TCP socket, I receive a SHUTDOWN message on my mapped UART. Then if I send an AT+WIPCLOSE=2,1, I receive CME ERROR: 843 (since the server has already closed its socket). This causes me to switch to AT mode and then if I issue AT+WIPCLOSE again, I get an OK to that. This ‘kind of’ works, but I am trying to get rid of the CME ERROR and close the socket on my end gracefully.  
I realised that I should be sending the AT+WIPCLOSE after I switch back to the AT mode. So, now I tried sending ‘+++’ sequence, but I still receive the CME ERROR: 843 as a response to that. Our application waits 2 secs after the SHUTDOWN response, then sends the first ‘+’, waits 100 msec, sends the second ‘+’, waits 100 msecs and then sends the last ‘+’. After about 650 msecs I receive the CME ERROR: 843 on the mapped UART.  
We have one active UART mapped at a time and hence, I cannot use ‘AT+WIPDATA=2,index,0’ from another UART to switch to AT mode.  
Any help would be appreciated.  
Thanks and Regards,  
-Kiran Nagi

---

<div class="post-metadata">

**Author:** ![blackyblack](https://avatars.discourse-cdn.com/v4/letter/b/2acd7d/32.png) [@blackyblack](https://forum.sierrawireless.com/u/blackyblack)\
**Post date:** [September 1, 2009, 8:09am UTC](https://forum.sierrawireless.com/t/gracefully-closing-the-socket/3594/2 "2009-09-01T08:09:33Z")

</div>

Check AT&S and AT&D commands. Maybe it helps.
