wiznet configuration settings in a struct

can anybody tell me why the following will not work

I’m trying to store the wiznet config settings in a struct so i can eventually store and retrieve from the eeprom so that i don’t have to hard code the settings

setting up byte arrays and passing them to ethernet.begin works but not when i pass them in from the struct

#include <Ethernet.h>

struct config_t
{
  byte mac[6];
  byte ip[4];
  byte subnet[4];
  byte gateway[4];
  byte server[4];
  char path[192];
};

struct config_t configuration = {
  {
    0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED                  }
  , {
    192,168,0,54                  }
  , {
    255,255,255,0                  }
  , {
    192,168,0,1                  }
  , {
    73,86,153,136                  }
  ,{
    '/','p','\0'        }
};

Client client(configuration.server, 80);

void setup()
{

  Ethernet.begin(configuration.mac, configuration.ip, configuration.gateway, configuration.subnet);
  Serial.begin(9600);
    delay(500);

    Serial.println("Ready:");

}

void loop()
{

    if (client.connect()) {
      client.println("Test");
      client.println();
      client.stop();
    } 
    else {
      Serial.println("connection failed");
    }

}

Thanks
JEff

oops! there is a delay(1000) that should be in the main loop so that the data will eventually be sent once per second

I can't see anything wrong with the coding of doing that. I do see that this may be problematic:

void loop()
{

    if (client.connect()) {
      [glow]client.println("Test");[/glow]      client.println();
      client.stop();
    }
    else {
      Serial.println("connection failed");
    }

}

My webserver wouldn't like that command too much.

Are you saying that it isn't sending the packet with "test" in it, or that the ethernet isn't being initialized with the correct address and it is failing in another way?

i just put "test" in there when i made this code example. it is outputting the "connection failed" message after a long timeout period

it is not being initialized correctly i think and i can't figure out how to read what the ethernet class has after i put my values in to see if they took

I can't connect to that IP address either - have you verified that is correct? (or is it some sneaky internal webserver that I don't get to play with...)

yes, it is correct. i have been successfully using my data logger with this setup. It is one of those so called shared ip addresses that requires you to access it like so 74.86.153.136/~latenigh

so i just set my get statement up like this GET /~latenigh/zzz.php?speed=24 HTTP/1.0

but this part all works fine.

for some reason i don't think the ethernet initialization is happening again this all works fine when i hard code all the settings. but when i try to set them from the struct is where the problems start Jeff

interesting. Try this. Instead of

struct config_t configuration = {

make it declared like this:

config_t configuration = {

One of my compilers won't accept the first - it says config_t is being redefined.

Just a stab...