lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] tcp_connect hangs


From: Carl D. Blake
Subject: [lwip-users] tcp_connect hangs
Date: Wed, 20 Dec 2006 09:49:44 -0700

I'm using lwip with rawapi.  I've successfully got a listen to work with
the system.  However, when I attempt to connect to another computer the
call to tcp_connect hangs.  No callbacks are called and the entire
system stops.  The code sequence is:

{
    struct ip_addr ipa;
    int ret = 0;
    err_t err;

    lpr_state_info = mem_malloc( sizeof( lpr_state_info ) );
    if( lpr_state_info != NULL ) {
        lpr_state_info->tpp = tcp_new();
        if( lpr_state_info->tpp != NULL ) {
            err = tcp_bind( lpr_state_info->tpp, IP_ADDR_ANY, 731 );
            if( err == ERR_OK ) {
                IP4_ADDR( &ipa, 10, 0, 1, 168 );
                err = tcp_connect( lpr_state_info->tpp,  &ipa, 10001, 
connect_cb );
                if( err != ERR_OK ) {
                    mem_free( lpr_state_info );
                    lpr_state_info = NULL;
                    ret = -1;
                }
            } else {
                mem_free( lpr_state_info );
                lpr_state_info = NULL;
                ret = -1;
            }
        } else {
            mem_free( lpr_state_info );
            lpr_state_info = NULL;
            ret = -1;
        }
    } else {
        ret = -1;
    }

    return ret;
}

I am running this on a FreeScale MPC8271 processor (big endian).  My
lwipopts.h file is:

#ifndef __LWIPOPTS_H__
#define __LWIPOPTS_H__

/* #define LWIP_DEBUG */
/* #define TCP_DEBUG    DBG_ON */

#define NO_SYS                  1
#define LWIP_CALLBACK_API       1

/* ---------- Memory options ---------- */
/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
   lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
   byte alignment -> define MEM_ALIGNMENT to 2. */
/* tried 4 byte alignment, but that seems to cause problems with pbuf
 * routines */
#define MEM_ALIGNMENT           4

/* MEM_SIZE: the size of the heap memory. If the application will send
a lot of data that needs to be copied, this should be set high. */
#define MEM_SIZE                100 * 1024

/* The following four are used only with the sequential API and can be
   set to 0 if the application only will use the raw API. */
/* MEMP_NUM_NETBUF: the number of struct netbufs. */
#define MEMP_NUM_NETBUF         0
/* MEMP_NUM_NETCONN: the number of struct netconns. */
#define MEMP_NUM_NETCONN        0
/* MEMP_NUM_APIMSG: the number of struct api_msg, used for
   communication between the TCP/IP stack and the sequential
   programs. */
#define MEMP_NUM_API_MSG        0
/* MEMP_NUM_TCPIPMSG: the number of struct tcpip_msg, which is used
   for sequential API communication and incoming packets. Used in
   src/api/tcpip.c. */
#define MEMP_NUM_TCPIP_MSG      0

#define PBUF_POLL_SIZE          30
#define PBUF_POOL_BUFSIZE       1536
#define PBUF_LINK_HLEN          16

#define TCP_MSS                 1476
#define TCP_SND_BUF             (30 * 1024)
#define TCP_WND                 (16 * 1024)

#endif /* __LWIPOPTS_H__ */






reply via email to

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