Ethernet Connection error (Renesas Web Compiler)

Hi Okamiya Yuuki,

I have written a code which periodically searches google for some data and prints it serially. But the data is searched successfully only once afterwards the search is unsuccessful till the device is resetted again.

/* GR-PEACH Sketch Template V1.05 */
#include <Arduino.h>
#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
// Set the static IP address to use if the DHCP fails to assign
IPAddress ip(192,168,1,108);

unsigned long previousMillis = 0;        // will store last time LED was updated
// the follow variables is a long because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
unsigned long interval = 15000;           // interval at which to blink (milliseconds)
// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;

void googlesearch()
if (client.connect("", 80))
    // Make a HTTP request:
    client.println("GET /search?q=arduino HTTP/1.1");
    client.println("Connection: close");
else {
    Serial.println("connect pubnub error");

    while (client.connected()) {
        while (client.connected() && !client.available()); // wait
        char c =;
    Serial.print("Connection status:");
    // if the server's disconnected, stop the client:
  if (!client.connected()) {

void setup() {
 // Open serial communications and wait for port to open:
  Serial.println("Start to connect..");
  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    // try to congifure using IP address instead of DHCP:
    Ethernet.begin(mac, ip);
void loop()
unsigned long currentMillis = millis();
if(currentMillis - previousMillis > interval) {

    Serial.println("Starting google Search");
    // save the last time you blinked the LED
    previousMillis = currentMillis;   


I previously tried to send data to a cloud service via http get call but at that time too nly once data was uploaded successfully afterwards the device was not able to send the data till reset button was pressed. So i wrote a minimal code (below) which searches on google but this code too fails. I have attached the serial output snapshot too. Kindly solve this error as soon as possible.