TCP reconnection problem

I’m using HL8548 and AT commands to establish tcp connection and trying to make my software successfully handle tcp disconnections and gprs falls.

I am using Direct Data Flow and noticed connection problems with “NO CARRIER” message or not receiving any data for more than few seconds(my server sends data at least twice a second).

Is there an explanation or tutorial about what is the right way to restore tcp connection? sometimes I need to use CNXDOWN and CNXUP before it works, sometimes it takes less than 5 seconds, sometimes more than 30…

Another question, a more specific one:
After using KTCPCLOSE, KCNXDOWN and KCNXUP successfuly I check KTCPSTAT and get KTCPSTAT 1 -1
According to the data sheet one means the socket is only defined but not used. What should I do in this situation? wait till the status changes(it takes sometimes for more than a minute)? try to send KTCPCNX(get error in this situation)?

Any help about how to do it right will be appreciated

Can you share the AT logs?