Free (GPLv2) TCP/IP stack developed by TASS Belgium
Dependents: lpc1768-picotcp-demo ZeroMQ_PicoTCP_Publisher_demo TCPSocket_HelloWorld_PicoTCP Pico_TCP_UDP_Test ... more
PicoTCP. Copyright (c) 2013 TASS Belgium NV.
Released under the GNU General Public License, version 2.
Different licensing models may exist, at the sole discretion of the Copyright holders.
Official homepage: http://www.picotcp.com
Bug tracker: https://github.com/tass-belgium/picotcp/issues
Development steps:
initial integration with mbed RTOSgeneric mbed Ethernet driverhigh performance NXP LPC1768 specific Ethernet driverMulti-threading support for mbed RTOSBerkeley sockets and integration with the New Socket APIFork of the apps running on top of the New Socket APIScheduling optimizations- Debugging/benchmarking/testing
Demo application (measuring TCP sender performance):
Import programlpc1768-picotcp-demo
A PicoTCP demo app testing the ethernet throughput on the lpc1768 mbed board.
Diff: modules/pico_dns_client.c
- Revision:
- 65:8cdaaa1df01d
- Parent:
- 64:0225b609335e
- Child:
- 66:71a2ef45a035
--- a/modules/pico_dns_client.c Tue Sep 17 07:25:24 2013 +0000 +++ b/modules/pico_dns_client.c Wed Sep 18 08:47:37 2013 +0000 @@ -23,7 +23,7 @@ #define PICO_DNS_MAX_RESPONSE_LEN 256 /* DNS client retransmission time (msec) + frequency */ -#define PICO_DNS_CLIENT_RETRANS 4000 +#define PICO_DNS_CLIENT_RETRANS 2000 #define PICO_DNS_CLIENT_MAX_RETRANS 3 /* Default nameservers + port */ @@ -502,6 +502,7 @@ static int pico_dns_client_send(struct pico_dns_query *q) { + uint16_t * paramID = pico_zalloc(sizeof(uint16_t)); dns_dbg("DNS: sending query to %08X\n", q->q_ns.ns.addr); if (!q->s) return -1; @@ -509,19 +510,29 @@ return -1; pico_socket_send(q->s, q->query, q->len); - pico_timer_add(PICO_DNS_CLIENT_RETRANS, pico_dns_client_retransmission, q); + *paramID = q->id; + pico_timer_add(PICO_DNS_CLIENT_RETRANS, pico_dns_client_retransmission, paramID); return 0; } static void pico_dns_client_retransmission(unsigned long now, void *arg) { - struct pico_dns_query *q = (struct pico_dns_query *)arg; + //uint16_t id = *(uint16_t *)arg; + struct pico_dns_query *q = NULL; + struct pico_dns_query dummy; IGNORE_PARAMETER(now); + + if(!arg) + return; + // search for the dns query and free used space + dummy.id = *(uint16_t *)arg; + q = (struct pico_dns_query *)pico_tree_findKey(&DNSTable,&dummy); + pico_free(arg); + /* dns query successful? */ - if (!q->retrans) { - pico_dns_client_del_query(q->id); - return; + if (!q) { + return; } if (q->retrans++ <= PICO_DNS_CLIENT_MAX_RETRANS) { @@ -561,6 +572,7 @@ if (q->retrans) { q->callback(str, q->arg); q->retrans = 0; + pico_dns_client_del_query(q->id); } return 0; } @@ -656,7 +668,8 @@ int pico_dns_client_getname(const char *ip, void (*callback)(char *, void *), void *arg) { - char *inaddr_arpa = ".in-addr.arpa", *msg = NULL; + const char *inaddr_arpa = ".in-addr.arpa"; + char *msg = NULL; struct pico_dns_prefix *prefix = NULL; struct pico_dns_name *domain = NULL; struct pico_dns_query_suffix *qsuffix = NULL;