AirPrime and HL7548 AT Commands Interface Guide Rev10 0

Table Of Contents
4116303 Rev 10.0 August 10, 2017 289
AT Commands Interface Guide
Appendix
16.5.2. Server Mode
In this simple example, we emulate a daytime server. This server listens to port 13 and for each
connection it returns the date.
AT&K3
Hardware flow control activation
OK
AT+KCNXCFG=1,"GPRS","APN","log","password","0.0.0.0",
"0.0.0.0","0.0.0.0"
Set GPRS parameters (APN, login,
password)
OK
AT+KTCPCFG=1,1,,13
Set TCP listener and port number
+KTCPCFG: 1
Returns session ID 1
OK
AT+KTCPCNX=1
Initiate the server
OK
AT+KCGPADDR
+KCGPADDR: 0,"10.35.125.89"
Get the IP address to initiate a connection
request with a client
OK
+KTCP_SRVREQ: 1,2
A client requests a connection (session ID 2)
AT+KTCPSND=2,15
CONNECT
…Date and time…
Data is sent to the client read
OK
+KTCP_SRVREQ: 1,3
Another client requests a connection
(session ID 3); child mode for session 3
+KTCP_NOTIF: 2, 4
Client (session 2) closes the connection
AT+KTCPSND=3,15
CONNECT
…Date and time…
Data is sent to the client
OK
AT+KTCPCLOSE=3,1
OK
Close client session 3 and then session 3 is
deleted automatically (child mode for session
3)
AT+KTCPCLOSE=1,1
Close server session 1
OK
AT+KTCPDEL=1
Delete session 1
OK