lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] tcp_connect is aborted (Was Re: tcp_new() returns NULL)


From: Chris Frost
Subject: [lwip-users] tcp_connect is aborted (Was Re: tcp_new() returns NULL)
Date: Thu, 2 Dec 2004 10:29:03 -0800
User-agent: Mutt/1.3.28i

tcp_new() now returns non-NULL (I had just left several _init functions
commented out...). Proceeding with trying to use the raw api over the
loopback to send a string, my tcp_connect() ends with my err() being called
with err=ERR_ABRT.

The essentials of what I'm doing are below. I init() the modules,
add a loopback interface, setup a listen, and then connect to the listening
port. About 12s later the err function I pass to tcp_err is called with
the err_t arg = ERR_ABRT.

I'm using lwip 1.0.0 and have defined NO_SYS to 1 and SYS_ARCH_TIMEOUT
to 0xffffffff, in case these details might be related.

Thanks for any suggestions!


        stats_init();
        mem_init();
        memp_init();
        pbuf_init();
        netif_init();

        struct netif nif;
        struct netif *nif_na = netif_add(&nif, &ipaddr, &netmask, &gateway, 
NULL,
                                                                                
                loopif_init, ip_input);
        assert(nif_na != NULL);
        netif_set_default(nif_na);
        tcp_init();

        stuct tcp_pcb *pcb = tcp_new(); // returns != NULL

        const u16_t port = 100;
        tcp_bind(pcb, IP_ADDR_ANY, port); // returns == ERR_OK
        struct tcp_pcb *pcb_listen = tcp_listen(pcb); // returns != NULL
        tcp_accept(pcb_listen, listen_accept);


        pcb = tcp_new(); // returns != NULL
        
        tcp_arg(pcb, NULL);
        tcp_recv(pcb, recv);
        tcp_err(pcb, err);
        tcp_poll(pcb, poll, 500)
        pcb->local_port = 0;
        struct ip_addr ip_loop;
        ip_loop.addr = INADDR_LOOPBACK;
        tcp_connect(pcb, &ip_loop, port, connected); // returns == ERR_OK


        // loop forever, calling tcp_fasttmr and tcp_slowtmr every ~200ms and 
~500ms


A note that my timing may be way off. For instance, poll() is never called even
though ~12s after tcp_connect() is called my err() is called. This is important
to correct later of course, but I'm assuming for the loopback interface it'll
do.

-- 
Chris Frost  |  <http://www.frostnet.net/chris/>
-------------+----------------------------------
Public PGP Key:
   Email address@hidden with the subject "retrieve pgp key"
   or visit <http://www.frostnet.net/chris/about/pgp_key.phtml>




reply via email to

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