#include #include byte mac[] = { 0x90, 0xA2, 0xDA, 0x0E, 0xFE, 0x40 }; // MAC address for Wiznet Ethernet shield IPAddress ip(192, 168, 2, 177); // Our IP address if DHCP failed IPAddress dnServer(192, 168, 2, 1); // Access to DNS server if DHCP failed IPAddress gateway(192, 168, 2, 1); // Access to gateway if DHCP failed IPAddress subnet(255, 255, 255, 0); // Subnet mask if DHCP failed EthernetClient client; // Initialize the Ethernet client void setup() { Serial.begin(9600); if (Ethernet.begin(mac) == 0) { Serial.println("Failed to configure Ethernet using DHCP!"); Ethernet.begin(mac, ip, dnServer, gateway, subnet); } Serial.print("IP address: "); Serial.println(Ethernet.localIP()); delay(1000); // Give the Ethernet shield a second to initialize } void loop() { // Connect to JsApp.us server and issue a HTTP GET request Serial.print("Connecting..."); if (client.connect("192.168.178.39", 1234)) { if (client.connected()) { Serial.println(" Connected!"); } else { Serial.println(" Connection failed!"); } // Read the answer while (client.connected()) { while (client.available()) { char c = client.read(); Serial.print(c); } } // If the server's disconnected, stop the client if (!client.connected()) { Serial.println(); Serial.println("Disconnecting ...\n"); client.stop(); } } // Repeat every seconds client.stop(); delay(1000); }