# Which are the correct steps for closing a client TCPsocket?

**URL:** <https://forum.sierrawireless.com/t/which-are-the-correct-steps-for-closing-a-client-tcpsocket/808>\
**Category:** Open AT\
**Created:** [October 23, 2006, 2:15pm UTC](https://forum.sierrawireless.com/t/which-are-the-correct-steps-for-closing-a-client-tcpsocket/808 "2006-10-23T14:15:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gioiese](https://avatars.discourse-cdn.com/v4/letter/g/46a35a/32.png) [@gioiese](https://forum.sierrawireless.com/u/gioiese)\
**Post date:** [October 23, 2006, 2:15pm UTC](https://forum.sierrawireless.com/t/which-are-the-correct-steps-for-closing-a-client-tcpsocket/808/1 "2006-10-23T14:15:28Z")

</div>

Hi,

In my application I send a data to a TCP server.  
Later I try to close the socket and the gprs.

To close the socket I send :  
ed\_SendDataExt( “”, 0, TRUE, ED\_ID\_TCPSOCKET\_1 );

To close the gprs I use :  
adl\_atCmdCreate(“AT+CGATT=0”,TRUE,CGATT\_0,"\*",NULL );

When The GPRS is deact in TCPHandler(s32 ResponseCode, TeDHandle id)  
the ResponseCode is :ED\_ERR\_GPRS\_SESSION\_LOST and if I restart the GPRS ed the new socket I always have the same answer.

I have also used : ed\_DialupConnectionStop(); after I receive ED\_OK\_ON \_HOOK but then in  
TCPHandler(s32 ResponseCode, TeDHandle id)  
the ResponseCode is always ED\_ERR\_GPRS\_SESSION\_LOST

Can you help me?

Thanks.

---

<div class="post-metadata">

**Author:** ![gioiese](https://avatars.discourse-cdn.com/v4/letter/g/46a35a/32.png) [@gioiese](https://forum.sierrawireless.com/u/gioiese)\
**Post date:** [October 26, 2006, 7:07am UTC](https://forum.sierrawireless.com/t/which-are-the-correct-steps-for-closing-a-client-tcpsocket/808/2 "2006-10-26T07:07:00Z")

</div>

Hi,

I have resolved my problem, and the problem was in the server.

But I now have another question.

When I send ““ed\_SendDataExt( “”, 0, TRUE, ED\_ID\_TCPSOCKET\_1 );””  
in TCPHandler(s32 ResponseCode, TeDHandle id)  
the ResponseCode is : ““ED\_OK\_TCP\_CLOSED:””,but my server doesn’t produce any event of TCP closing and when in my wavecom application (FASTRACK) I restart the GPRS and the new socket I can send data to the server , but the problem is that in the server I find two open sockets.

Can you help me?

Thanks.

---

<div class="post-metadata">

**Author:** ![jan](https://avatars.discourse-cdn.com/v4/letter/j/ce7236/32.png) [@jan](https://forum.sierrawireless.com/u/jan)\
**Post date:** [October 26, 2006, 7:36am UTC](https://forum.sierrawireless.com/t/which-are-the-correct-steps-for-closing-a-client-tcpsocket/808/3 "2006-10-26T07:36:13Z")

</div>

Hi gioiese,

I would also expect that this is a problem of the server. I have used the same command in a wavecom module and sure enough it closed the socket on the server side…

Best Regards,  
Jan
