[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] netconn->acceptmbox is NULL
From: |
Emil Ohlsson |
Subject: |
[lwip-users] netconn->acceptmbox is NULL |
Date: |
Fri, 5 Aug 2011 11:46:25 +0200 |
Hi!
I'm having serious trouble with getting lwIP up and running, first netconn_new
returned NULL, and now the mbox is NULL. I run the code below, and I've
attached my lwipopts last in the mail. For some reason cli->acceptmbox is NULL,
but there is no error indication before. The code runs on a Cortex M3 (LM3S
9B96) with SafeRTOS as a scheduler. The error handling is simply an infinite
loop and a printf. I've found an old thread about this kind of error
http://lists.gnu.org/archive/html/lwip-users/2008-10/msg00054.html, but the
solution didn't work for me.
I also tried to manually add cli->acceptmbox = sys_mbox_new(...) just before
doing netconn_accept, but that didn't help much. That only resulted
netconn_accept to block, even when there was data (monitored Ethernet using
wireshark).
Does anybody know why this doesn't work? The lwipopts.h shipped with
StellarisWare isn't configured for netconns for some reason. If somebody have a
working lwipopts.h configured for netconns and would be willing to share that
would be very helpful. Any comments, hints, ideas are very welcome.
cli = netconn_new(NETCONN_UDP);
if ( cli == NULL ) {/* Error handling */ }
if ( cli->err != ERR_OK ) {/* Error handling */ }
res = netconn_bind(cli, IP_ADDR_ANY, 9875);
if ( res != ERR_OK ) {/* Error handling */ }
res = netconn_listen(cli);
if ( res != ERR_OK ) {/* Error handling */ }
if ( cli->err != ERR_OK ) {/* Error handling */ }
UARTprintf("Listening on port 9875\n");
while(1) {
// cli->acceptmbox is NULL
This test fails -----------> if ( cli->acceptmbox == NULL ) {/* Error
handling */ }
srv = netconn_accept(cli);
if ( srv == NULL ) {/* Error handling */ }
// ....
inbuf = netconn_recv(srv);
/Emil
//*****************************************************************************
//
// ---------- Platform specific locking ----------
//
//*****************************************************************************
#define SYS_LIGHTWEIGHT_PROT 1 // default is 0
//#define NO_SYS 0 // default is 0
//#define MEMCPY(dst,src,len) memcpy(dst,src,len)
//#define SMEMCPY(dst,src,len) memcpy(dst,src,len)
//*****************************************************************************
//
// ---------- Memory options ----------
//
//*****************************************************************************
#define MEM_LIBC_MALLOC 0
#define MEM_ALIGNMENT 4 // default is 1
#define MEM_SIZE (16 * 1024) // default is 1600, was 16K
#define MEMP_OVERFLOW_CHECK 0
#define MEMP_SANITY_CHECK 0
#define MEM_USE_POOLS 0
#define MEMP_USE_CUSTOM_POOLS 0
//*****************************************************************************
//
// ---------- Internal Memory Pool Sizes ----------
//
//*****************************************************************************
#define MEMP_NUM_PBUF 64 // Default 16, was 16
#define MEMP_NUM_RAW_PCB 4
#define MEMP_NUM_UDP_PCB 10 // One per "connection"
#define MEMP_NUM_TCP_PCB 10 // default is 5
#define MEMP_NUM_TCP_PCB_LISTEN 8
#define MEMP_NUM_TCP_SEG 48 // default is 16
//#define MEMP_NUM_REASSDATA 5
//#define MEMP_NUM_ARP_QUEUE 30
#define MEMP_NUM_IGMP_GROUP 8
#define MEMP_NUM_SYS_TIMEOUT 10
#define MEMP_NUM_NETBUF 2
#define MEMP_NUM_NETCONN 4
//#define MEMP_NUM_TCPIP_MSG_API 8
//#define MEMP_NUM_TCPIP_MSG_INPKT 8
#define PBUF_POOL_SIZE 64 // Default 16, was 36
//*****************************************************************************
//
// ---------- ARP options ----------
//
//*****************************************************************************
#define LWIP_ARP 1
#define ARP_TABLE_SIZE 10
#define ARP_QUEUEING 1
#define ETHARP_TRUST_IP_MAC 1
//*****************************************************************************
//
// ---------- IP options ----------
//
//*****************************************************************************
#define IP_FORWARD 0
#define IP_OPTIONS_ALLOWED 1
#define IP_REASSEMBLY 0 // default is 1
//#define IP_FRAG 0 // default is 1
//#define IP_REASS_MAXAGE 3
//#define IP_REASS_MAX_PBUFS 10
//#define IP_FRAG_USES_STATIC_BUF 1
//#define IP_FRAG_MAX_MTU 1500
//#define IP_DEFAULT_TTL 255
//*****************************************************************************
//
// ---------- ICMP options ----------
//
//*****************************************************************************
#define LWIP_ICMP 1
#define ICMP_TTL 255
//*****************************************************************************
//
// ---------- RAW options ----------
//
//*****************************************************************************
#define LWIP_RAW 1
#define RAW_TTL (IP_DEFAULT_TTL)
//*****************************************************************************
//
// ---------- DHCP options ----------
//
//*****************************************************************************
#define LWIP_DHCP 1 // default is 0
#define DHCP_DOES_ARP_CHECK 1
//*****************************************************************************
//
// ---------- UPNP options ----------
//
//*****************************************************************************
//#define LWIP_UPNP 0
//*****************************************************************************
//
// ---------- PTPD options ----------
//
//*****************************************************************************
//#define LWIP_PTPD 0
//*****************************************************************************
//
// ---------- AUTOIP options ----------
//
//*****************************************************************************
#define LWIP_AUTOIP 1 // default is 0
#define LWIP_DHCP_AUTOIP_COOP ((LWIP_DHCP) && (LWIP_AUTOIP))
// default is 0
#define LWIP_DHCP_AUTOIP_COOP_TRIES 5 // default is 9
//*****************************************************************************
//
// ---------- SNMP options ----------
//
//*****************************************************************************
//#define LWIP_SNMP 0
//#define SNMP_CONCURRENT_REQUESTS 1
//#define SNMP_TRAP_DESTINATIONS 1
//#define SNMP_PRIVATE_MIB 0
//#define SNMP_SAFE_REQUESTS 1
//*****************************************************************************
//
// ---------- IGMP options ----------
//
//*****************************************************************************
#define LWIP_IGMP 1
//*****************************************************************************
//
// ---------- DNS options -----------
//
//*****************************************************************************
//#define LWIP_DNS 0
//#define DNS_TABLE_SIZE 4
//#define DNS_MAX_NAME_LENGTH 256
//#define DNS_MAX_SERVERS 2
//#define DNS_DOES_NAME_CHECK 1
//#define DNS_USES_STATIC_BUF 1
//#define DNS_MSG_SIZE 512
//*****************************************************************************
//
// ---------- UDP options ----------
//
//*****************************************************************************
#define LWIP_UDP 1
//#define LWIP_UDPLITE 0
#define UDP_TTL 255
//*****************************************************************************
//
// ---------- TCP options ----------
//
//*****************************************************************************
#define LWIP_TCP 1
#define TCP_TTL 1
#define TCP_WND 2048 // default is 2048
#define TCP_MAXRTX 12
#define TCP_SYNMAXRTX 6
#define TCP_QUEUE_OOSEQ 1
#define TCP_MSS 1024 // default is 128
//#define TCP_CALCULATE_EFF_SEND_MSS 1
#define TCP_SND_BUF (6 * TCP_MSS)
// default is 256
//#define TCP_SND_QUEUELEN (MEMP_NUM_TCP_SEG)
// default is (4 *
(TCP_SND_BUF/TCP_MSS))
//#define TCP_SNDLOWAT (TCP_SND_BUF/2)
//#define TCP_LISTEN_BACKLOG 0
//#define TCP_DEFAULT_LISTEN_BACKLOG 0xff
//*****************************************************************************
//
// ---------- API options ----------
//
//*****************************************************************************
//#define LWIP_EVENT_API 0
//#define LWIP_CALLBACK_API 1
//*****************************************************************************
//
// ---------- Pbuf options ----------
//
//*****************************************************************************
#define PBUF_LINK_HLEN 16 // default is 14 (eth
header)
#define PBUF_POOL_BUFSIZE 512
// default is
LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_HLEN)
#define ETH_PAD_SIZE 2 // default is 0
//*****************************************************************************
//
// ---------- Network Interfaces options ----------
//
//*****************************************************************************
//#define LWIP_NETIF_HOSTNAME 0
//#define LWIP_NETIF_API 0
//#define LWIP_NETIF_STATUS_CALLBACK 0
//#define LWIP_NETIF_LINK_CALLBACK 0
//#define LWIP_NETIF_HWADDRHINT 0
//*****************************************************************************
//
// ---------- LOOPIF options ----------
//
//*****************************************************************************
//#define LWIP_HAVE_LOOPIF 0
//#define LWIP_LOOPIF_MULTITHREADING 1
//*****************************************************************************
//
// ---------- Thread options ----------
//
//*****************************************************************************
#define TCPIP_THREAD_NAME "tcpip_thread"
#define TCPIP_THREAD_STACKSIZE 1024
#define TCPIP_THREAD_PRIO 3
#define TCPIP_MBOX_SIZE 32
//#define SLIPIF_THREAD_NAME "slipif_loop"
//#define SLIPIF_THREAD_STACKSIZE 0
//#define SLIPIF_THREAD_PRIO 1
//#define PPP_THREAD_NAME "pppMain"
//#define PPP_THREAD_STACKSIZE 0
//#define PPP_THREAD_PRIO 1
//#define DEFAULT_THREAD_NAME "lwIP"
//#define DEFAULT_THREAD_STACKSIZE 0
//#define DEFAULT_THREAD_PRIO 1
#define DEFAULT_RAW_RECVMBOX_SIZE 6
#define DEFAULT_UDP_RECVMBOX_SIZE 6
#define DEFAULT_TCP_RECVMBOX_SIZE 6
#define DEFAULT_ACCEPTMBOX_SIZE 6
//*****************************************************************************
//
// ---------- Sequential layer options ----------
//
//*****************************************************************************
//#define LWIP_TCPIP_CORE_LOCKING 0
//#define LWIP_NETCONN 1 // default is 1
//*****************************************************************************
//
// ---------- Socket Options ----------
//
//*****************************************************************************
#define LWIP_SOCKET 0 // default is 1
//#define LWIP_COMPAT_SOCKETS 1
//#define LWIP_POSIX_SOCKETS_IO_NAMES 1
//#define LWIP_TCP_KEEPALIVE 0
//#define LWIP_SO_RCVTIMEO 0
//#define LWIP_SO_RCVBUF 0
//#define SO_REUSE 0
- [lwip-users] netconn->acceptmbox is NULL,
Emil Ohlsson <=
- Re: [lwip-users] netconn->acceptmbox is NULL, Kieran Mansley, 2011/08/05
- Re: [lwip-users] netconn->acceptmbox is NULL, Emil Ohlsson, 2011/08/05
- Re: [lwip-users] netconn->acceptmbox is NULL, Emil Ohlsson, 2011/08/05
- Re: [lwip-users] netconn->acceptmbox is NULL, Kieran Mansley, 2011/08/05
- Re: [lwip-users] netconn->acceptmbox is NULL, Emil Ohlsson, 2011/08/05
- Re: [lwip-users] netconn->acceptmbox is NULL, Bill Auerbach, 2011/08/05
- Re: [lwip-users] netconn->acceptmbox is NULL, Kieran Mansley, 2011/08/05
- Re: [lwip-users] netconn->acceptmbox is NULL, Kieran Mansley, 2011/08/05