Closed nrk6208 closed 7 years ago
Hi,
Could you be a bit more specific?
Thanks
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.
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());
}
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); } } }