Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WiFi shield issue: client.connect(server, 80) #2531

Closed
piyali1988 opened this issue Jan 3, 2015 · 1 comment
Closed

WiFi shield issue: client.connect(server, 80) #2531

piyali1988 opened this issue Jan 3, 2015 · 1 comment
Assignees
Labels
Library: Wifi The Wifi Arduino library

Comments

@piyali1988
Copy link

client.connect(server, 80); is not working. Here is the code:

include <SPI.h>

include <WiFi.h>

include <WiFiClient.h>

include <WiFiServer.h>

undef int

undef abs

undef double

undef float

undef round

int SensorIn1 = 1;
int led_pin = 13;

char devid[] = "v90EC98310145483";

int del=100; // Amount of seconds delay between posting to google docs.

char postmsg[100];
int k=0;
int temp_av = 0;
char server[] = "api.pushingbox.com";
char ssid[] = "**_";
char pass[] = "_
";
WiFiClient client;

void setup()
{
Serial.begin(9600);
WiFi.begin(ssid, pass);
delay(1000);
Serial.println("connecting...");
}

void loop(){

int val;
val = analogRead(SensorIn1);
Serial.println(val);

// Post to Google Form.............................................
if (client.connect(server, 80))
{
k=0;
Serial.println("connected");
sprintf(postmsg,"GET /pushingbox?devid=%c&status=%d HTTP/1.1",devid,val);
client.println(postmsg);
client.println("Host: api.pushingbox.com");
client.println("Connection: close");
client.println();

Serial.println(postmsg);
Serial.println("Host: api.pushingbox.com");
Serial.println("Connection: close");
Serial.println();

 delay(1000);
 client.stop();

}
delay(1000);

if (!client.connected())
{
Serial.println();
Serial.println("disconnecting.");
client.stop();
k==1;
return;
}
}

The output I receive is
connecting....
456
disconnecting.
563
disconnecting.
and so on..
I have tried using different servers and accordingly selected the port numbers (eg 80, 443 etc) but the it never connects to the server. Kindly help.

@agdl
Copy link
Member

agdl commented Jul 12, 2016

This issue was moved to arduino-libraries/WiFi#24

@agdl agdl closed this as completed Jul 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Library: Wifi The Wifi Arduino library
Projects
None yet
Development

No branches or pull requests

4 participants