Created
August 29, 2015 16:37
-
-
Save janajri/acd97e1d6d41482b43c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void httpRequest() { | |
// We dont want to close the tcp socket | |
// client.stop(); | |
// if there's a successful connection: | |
if (client.connect(server, 80)) { | |
Serial.println("connecting..."); | |
// send the HTTP PUT request: | |
client.println("GET /latest.txt HTTP/1.1"); | |
client.println("Host: www.arduino.cc"); | |
client.println("User-Agent: ArduinoWiFi/1.1"); | |
//client.println("Connection: close"); | |
client.println("Connection: keep-alive"); // we want to keep the connection alive | |
client.println(); | |
client.println("GET /latest2.txt HTTP/1.1"); | |
client.println("Host: www.arduino.cc"); | |
client.println("User-Agent: ArduinoWiFi/1.1"); | |
client.println("Connection: keep-alive"); // we want to keep the connection alive | |
client.println(); | |
// note the time that the connection was made: | |
lastConnectionTime = millis(); | |
} else { | |
// if you couldn't make a connection: | |
Serial.println("connection failed"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm not sure if the IF statement on line 6 would be necessary. As you can see, I'm attempting to send two http requests right after each other.