lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] DHCP Problem?


From: xcb
Subject: [lwip-users] DHCP Problem?
Date: Fri, 3 Sep 2004 17:13:26 +0800

lwip-users
        i use lwip 1.0.0 and want to use DHCP ,but not succfull.what is the 
problem?
my init code :
        struct netif  nif;
        struct ip_addr ipaddr, netmask, gw;
        sys_sem_t sem;
        err_t err;

//    lwip init......
        sem = sys_sem_new(0);
        tcpip_init(tcpip_init_done, &sem);
        sys_sem_wait(sem);
        sys_sem_free(sem);

        netif_init();
        
        sys_timeout(DHCP_FINE_TIMER_MSECS,
                (sys_timeout_handler)dhcp_fine_timer, NULL);
        sys_timeout((u32_t)DHCP_COARSE_TIMER_SECS * 1000,
                (sys_timeout_handler)dhcp_coarse_timer, NULL);

        IP4_ADDR(&gw, 0,0,0,0);
        IP4_ADDR(&ipaddr, 0,0,0,0);
        IP4_ADDR(&netmask, 255,255,255,255);

        netif_set_default(netif_add(&nif,&ipaddr, &netmask, &gw,NULL, 
ethernetif_init,
                tcpip_input));

        err = dhcp_start(&nif);   
        if(err!=ERR_OK)
        {
                printf("DHCP start failed\n");          
        }

{
void dhcp_fine_timer(void *arg)
{
        dhcp_fine_tmr();
        sys_timeout(DHCP_FINE_TIMER_MSECS, 
(sys_timeout_handler)dhcp_fine_timer, 
                NULL);
}

void dhcp_coarse_timer(void *arg)
{
        dhcp_coarse_tmr();
        sys_timeout((u32_t)DHCP_COARSE_TIMER_SECS * 1000,
                (sys_timeout_handler)dhcp_coarse_timer, NULL);
}
}





reply via email to

[Prev in Thread] Current Thread [Next in Thread]