washo4evr / Socket.io-v1.x-Library

Socket.io Library for Arduino
108 stars 58 forks source link

returns Pas de connexion ... #41

Closed nrk6208 closed 7 years ago

nrk6208 commented 7 years ago

include "SocketIOClient.h"

//#include "Ethernet.h" //#include "SPI.h"

include

const char ssid = "test"; const char password = "testtest"; SocketIOClient client;

//byte mac[] = { 0xAA, 0x00, 0xBE, 0xEF, 0xFE, 0xEE }; char host[] = "192.168.3.101"; int port = 3484;

extern String RID; extern String Rname; extern String Rcontent;

unsigned long previousMillis = 0; long interval = 10000; void setup() { pinMode(0, OUTPUT); //for some ethernet shield on the mega : disables the SD and enables the W5100 digitalWrite(0, LOW); // pinMode(4, OUTPUT); // digitalWrite(4, HIGH); Serial.begin(115200);

// Ethernet.begin(mac);

Serial.println(); Serial.println(); Serial.print("Connecting to "); Serial.println(ssid);

WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); }

Serial.println(""); Serial.println("WiFi connected");
Serial.println("IP address: "); Serial.println(WiFi.localIP());

if (!client.connect(host, port))
    Serial.println("Not connected.");
if (client.connected())
{
    client.send("connection", "message", "Connected !!!!");
}
else
{
    Serial.println("Connection Error");
    while(1);
}
delay(1000);

}

void loop() { unsigned long currentMillis = millis(); if(currentMillis - previousMillis > interval) { previousMillis = currentMillis; //client.heartbeat(0); client.send("atime", "message", "Time please?"); } if (client.monitor()) { Serial.println(RID); if (RID == "atime" && Rname == "time") { Serial.print("Time is "); Serial.println(Rcontent); } } }

washo4evr commented 7 years ago

Hi,

Could you be a bit more specific?

Thanks

nrk6208 commented 7 years ago

Thank god, anyway I know the issue, There is no error at client and server side. The main problem is with firewall. Once I have turned off the firewall, the client is connected with server.