Need help to connect RCM4400W to Router using DHCP

I finish buying a RCM4400W and i want connect it to router 2wire using DHCP, only i want that this connecting to my home network, i tried with this code:


#class auto
#define TCPCONFIG 5
#define _WIFI_MODE WIFICONF_INFRASTRUCT
#define _WIFI_SSID "HOME_LAN"
#define _WIFI_WEP_FLAG WIFICONF_WEP_ENABLE
#define _WIFI_AUTH_MODE WIFICONF_AUTH_OPEN_SYS
#define _WIFI_KEY0 0x57, 0x57, 0x16, 0x22, 0x87
#define _WIFI_KEY1 0x57, 0x57, 0x16, 0x22, 0x87
#define _WIFI_KEY2 0x57, 0x57, 0x16, 0x22, 0x87
#define _WIFI_KEY3 0x57, 0x57, 0x16, 0x22, 0x87

#memmap xmem
#use "dcrtcp.lib"

main()
{
   unsigned char c;

   sock_init();

   printf( "My IP address is %s

", inet_ntoa(buffer, gethostid()) );

   while (1) {
      tcp_tick(NULL);

      if (kbhit()) {
       	c = getchar();
         if (tolower(c) == 'q') {
				printf("Exit
");
				break;
			}
      }
   }

   printf("

Hi, I had the same problem, and I solved it, I don’t know if this is the best way, but anyway, hope this be useful I think that in Rabbit they made a MACRO where they defined that the default lenght of a WEP key is 13 hexadecimals, so, if you define as you did:

#define _WIFI_KEY3 0x57, 0x57, 0x16, 0x22, 0x87

or directly in the tcp_config.lib:

#ifndef _WIFI_KEY0
#define _WIFI_KEY0 0x57, 0x57, 0x16, 0x22, 0x87
#endif

The Dynamic C won`t know that is 5 hexadecimals

So, What I did as a proof was to define the WEP Key as a constant:

const char CLAVE[5]={0x57,0x57,0x16,0x22,0x87};

and then in the program I redifined the WEP key using the wifi_ioctl function:

wifi_ioctl(IF_WIFI0,WIFI_WEP_KEY0,&CLAVE,5);

this way, in the fourth parameter you specify that it’s 5 hexadecimal instead of 13, And … It worked, my DHCP router gave me an IP address.