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: Socket/bsd/stack_endpoint.cpp
- Revision:
- 97:e73b01cb3147
- Parent:
- 90:478be2fd92ac
- Child:
- 98:b0575c2cc01c
--- a/Socket/bsd/stack_endpoint.cpp Wed Oct 16 11:51:10 2013 +0000 +++ b/Socket/bsd/stack_endpoint.cpp Wed Oct 16 12:40:29 2013 +0000 @@ -28,7 +28,6 @@ Mutex *PicoTcpLock; Queue<void,32> *PicoTcpEvents; -static struct stack_endpoint *ep_accepting; static Thread * serverThread = NULL; /* Testing ng blocking mechanism */ @@ -64,17 +63,12 @@ { struct stack_endpoint *ep = (struct stack_endpoint *)s->priv; if (!ep) { - if (ep_accepting != NULL) { - ptsock_dbg("Delivering %02x to accepting socket...\n", ev); - ep = ep_accepting; - } else { - ptsock_dbg("WAKEUP: socket not found! ev=%04x\n", ev); - return; - } + ptsock_dbg("WAKEUP: socket not found! ev=%04x\n", ev); + return; } //if (((ep->revents & PICO_SOCK_EV_RD) == 0) && (ev & PICO_SOCK_EV_RD)) // printf("Activating RD\n"); - if(!ep || !ep->s || !ep->queue) + if(!ep->s || !ep->queue) { ptsock_dbg("Endpoint null warning : ep=%p, ep->s=%p, ep->queue=%p\n",ep,ep->s,ep->queue); return; @@ -153,10 +147,7 @@ int ret; PicoTcpLock->lock(); ret = pico_socket_listen(ep->s, queue); - ep_accepting = (struct stack_endpoint *) pico_zalloc(sizeof(struct stack_endpoint)); - ep_accepting->queue = new Queue<void,1>(); - if (!ep_accepting) - ret = -1; + if(ret == 0) ep->state = SOCK_LISTEN; PicoTcpLock->unlock(); @@ -188,14 +179,12 @@ struct stack_endpoint *picotcp_accept(struct stack_endpoint *ep, struct sockaddr *_cli_addr, socklen_t *len) { int retval; - struct stack_endpoint *aep = ep_accepting; + struct sockaddr_in *cli_addr = (struct sockaddr_in *)_cli_addr; - ep_accepting = (struct stack_endpoint *) pico_zalloc(sizeof(struct stack_endpoint)); - if (ep_accepting) - ep_accepting->queue = new Queue<void,1>(); - - - if (!aep) + struct stack_endpoint *aep = (struct stack_endpoint *) pico_zalloc(sizeof(struct stack_endpoint)); + if (aep) + aep->queue = new Queue<void,1>(); + else return aep; PicoTcpLock->lock();