User manual
48 3 | TCP-Client
3
007
String getRe
q
uest = "GET " + Sub
p
age + " HTTP/1.1\r
\
nHost:" + Host + "\r\n"
;
008
success &= sendCom
(
"AT+CIPSEND=" +
S
tring(getRe
q
uest.length() + 2), ">")
;
00
9
010 esp8266.println(getRequest)
;
0
11
0
12
if
(
esp8266.fin
d(
"+IPD"
))
0
13 {
014 if (esp8266.find("
\
r
\
n
\
r
\
n")
)
01
5
{
01
6 xyear = es
p
8266.
p
arseInt
();
0
1
7
xmonth = es
p
8266.
p
arseInt()
;
0
1
8 x
d
ay = esp8266.parseInt
();
01
9
xhour = es
p
8266.
p
arseInt()
;
0
2
0
xminute = esp8266.parseInt()
;
02
1
xsecond = esp8266.parseInt()
;
02
2
0
23 if (xda
y
< 0) xda
y
*= -1;
//
Because of
d
ate seperator - parseInt detects negativ intege
r
024 if (xmonth < 0) xmonth *= -1;
//
Because of
d
ate seperator - parseInt detects negativ intege
r
0
2
5
0
26
02
7
setTime(xhour, xminute, xsecond, xda
y
, xmonth,
xy
ear)
;
028 sendCom("
A
T+CIPCLOSE"
,
"OK")
;
02
9
re
t
urn
t
rue
;
030 }
03
1
else return false
;
03
2
}
033 else return false
;
034 }
Dieser Funktion werden Parameter für die Hostadresse und für die Sub
-
adresse über
g
eben. Daraus wird schließlich die Get-Request-Anfra
g
e
erstellt und nach dem Herstellen einer Verbindun
g
an den TCP-Server de
r
10215-5 Lernpaket Internet of Things_02.indd 4810215-5 Lernpaket Internet of Things_02.indd 48 19.04.2016 12:17:2319.04.2016 12:17:23