# Getting TCP connection error

**URL:** <https://forum.sierrawireless.com/t/getting-tcp-connection-error/7580>\
**Category:** Forum and Source related topics\
**Created:** [November 21, 2014, 7:28am UTC](https://forum.sierrawireless.com/t/getting-tcp-connection-error/7580 "2014-11-21T07:28:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pradeep14892](https://avatars.discourse-cdn.com/v4/letter/p/f0a364/32.png) [@pradeep14892](https://forum.sierrawireless.com/u/pradeep14892)\
**Post date:** [November 21, 2014, 7:28am UTC](https://forum.sierrawireless.com/t/getting-tcp-connection-error/7580/1 "2014-11-21T07:28:58Z")

</div>

Hi all ,  
I am new to client server communication.Below is code I have tried to establish connection between my gprs modem and PC to send data.It is showing as TCP connection error.As i gained from discussions,I have to give static Ip for my gprs modem (HL6528).how?? and do “i have to give DNS server address” ?? and one more is “what changes to firewall to be made and how to do?” confused …plz help …how to proceed further…

AT+CGDCONT=1,“IP”,“internet”,“0.0.0.0”,0,0 // idea  
OK  
atd_99__1#  
CONNECT  
~ÿ}#À!}!}!} }.}"}&} }} } }#}$À#óM ~~ÿ}#À!}!}!} }.}"}&} }_} } }#}$À#óM~~ ÿ}#À!}!}!} }.}"}&} }\*} } }#}$À#óM ~~ÿ}#À!}!}!} }.}"}&} }_} } }#}$À#óM~~ ÿ}#À!}!}!} }.}"}&} }_} } }#}$À#óM~  
NO CARRIER  
at&k3  
OK  
AT+KCNXCFG=0,“GPRS”,“internet”,"","",”0.0.0.0”,”0.0.0.0”,”0.0.0.0”  
OK  
AT+KCNXTIMER=0,60,2,70  
OK  
AT+KCNXPROFILE=0  
OK

AT+CGATT=1  
OK  
at+ktcpcfg=0,0,“192.168.1.14”,139 //IP address of my PC and 139 is listening  
+KTCPCFG: 1  
OK  
AT+KTCPCNX=1 //client  
+KTCP\_NOTIF:1,5 //tcp connection error

---

<div class="post-metadata">

**Author:** ![krima919](https://avatars.discourse-cdn.com/v4/letter/k/94ad74/32.png) [@krima919](https://forum.sierrawireless.com/u/krima919)\
**Post date:** [November 21, 2014, 7:58am UTC](https://forum.sierrawireless.com/t/getting-tcp-connection-error/7580/2 "2014-11-21T07:58:51Z")

</div>

192.168.1.14 is a local address on your network. It is not accessible from the internet. You must setup a server on a public IP. The client, in your case the HL6 does not need a public IP.  
I suggest that you take a look at the end of the AT command guide for the HL6 and HL8. Section 20.6 includes a few examples of how to setup a tcp connection.

I see no reason to do the ATD command.

---

<div class="post-metadata">

**Author:** ![pradeep14892](https://avatars.discourse-cdn.com/v4/letter/p/f0a364/32.png) [@pradeep14892](https://forum.sierrawireless.com/u/pradeep14892)\
**Post date:** [November 21, 2014, 9:11am UTC](https://forum.sierrawireless.com/t/getting-tcp-connection-error/7580/3 "2014-11-21T09:11:32Z")

</div>

thank you krima for your help …i will try

---

<div class="post-metadata">

**Author:** ![pradeep14892](https://avatars.discourse-cdn.com/v4/letter/p/f0a364/32.png) [@pradeep14892](https://forum.sierrawireless.com/u/pradeep14892)\
**Post date:** [November 22, 2014, 10:20am UTC](https://forum.sierrawireless.com/t/getting-tcp-connection-error/7580/4 "2014-11-22T10:20:36Z")

</div>

In my application ,I have to send gps data to server but i am trying to send some data initially to server(first step),I have tried as below ,but when sending data without giving end of pattern ,connection is closing immediately as below…how do i solve the problem .please help me anyone

AT+KCNXCFG=0,“GPRS”,“internet”,"","",“0.0.0.0”,“0.0.0.0”,“0.0.0.0”  
OK  
AT+KCNXTIMER=0,60,2,70  
OK  
AT+KCNXPROFILE=0  
OK  
AT+CGATT=1  
OK  
AT+KTCPCFG=0,0,“[www.facebook.com](http://www.facebook.com)”,80,1 //suppose consider facebook as server  
+KTCPCFG: 1  
OK  
AT+KTCPACKINFO=1  
+KTCPACKINFO: 1,2  
OK  
at+kpattern="#"  
OK  
AT+KTCPCNX=1  
OK  
AT+KTCPSND=1,20  
CONNECT // After connect I am unable to send data (giving ok response after 1 or 2 seconds ) and not able to see the data which i am sending  
OK  
+KTCP\_NOTIF: 1,6 //generic error  
+KTCP\_DATA: 1,1300  
at+ktcprcv=1,400  
CONNECT  
HTTP/1.1 400 Bad Request  
Content-Type: text/html; charset=utf-8  
Date: Sat, 22 Nov 2014 09:48:34 GMT  
Connection: close  
Content-Length: 3121

```
           <html lang="en" id="facebook">
                                           <head>
                                                     <title>Facebook | Error</title>
        <meta charset="utf-8">
                                  <meta http-equiv="cache-control" content="no-cache">
          <meta http-equiv="cache-control" content="no-store">
                                                                  <meta http-equiv=#

```

OK  
+KTCP\_DATA: 1,900  
at+ktcpackinfo=1  
+KTCPACKINFO: 1,2  
OK  
at+ktcpsnd=1,45  
CONNECT  
OK  
+KTCP\_NOTIF: 1,6 // generic error  
+KTCP\_ACK: 1,0 //data sent failure  
at+ktcpstat=1  
+KTCPSTAT: 3, -1, 0, 900  
OK

---

<div class="post-metadata">

**Author:** ![PavanForPushkal](https://avatars.discourse-cdn.com/v4/letter/p/e9a140/32.png) [@PavanForPushkal](https://forum.sierrawireless.com/u/PavanForPushkal)\
**Post date:** [December 18, 2018, 6:10am UTC](https://forum.sierrawireless.com/t/getting-tcp-connection-error/7580/5 "2018-12-18T06:10:51Z")

</div>

Pradeep,

I came across this page, it looks like I am also facing the similar issue. I hope you would have resolved your issue.  
In my case after CONNECT response from modem i send the data to [google.com](http://google.com) but i do not any response after that.  
Any Idea what could be the problem?
