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/TCPSocketConnection.cpp
- Revision:
- 24:8bff2b51ea3b
- Parent:
- 19:c7debad9a20a
diff -r 884f327c3647 -r 8bff2b51ea3b Socket/TCPSocketConnection.cpp --- a/Socket/TCPSocketConnection.cpp Mon Jun 10 08:01:01 2013 +0000 +++ b/Socket/TCPSocketConnection.cpp Tue Jun 11 21:10:23 2013 +0000 @@ -64,6 +64,7 @@ } int TCPSocketConnection::send(char* data, int length) { + int ret; if ((_ep < 0) || !_is_connected) return -1; @@ -75,11 +76,17 @@ return -1; } } - return picotcp_write(_ep, data, length); + ret = picotcp_write(_ep, data, length); + if (ret < length) { + _ep->revents &= (~PICO_SOCK_EV_WR); + printf("Short write\n"); + } + return ret; } // -1 if unsuccessful, else number of bytes written int TCPSocketConnection::send_all(char* data, int length) { + int ret; if ((_ep < 0) || !_is_connected) return -1; @@ -90,10 +97,16 @@ return 0; } } - return picotcp_write(_ep, data, length); + ret = picotcp_write(_ep, data, length); + if (ret < length) { + _ep->revents &= (~PICO_SOCK_EV_WR); + //printf("Short write\n"); + } + return ret; } int TCPSocketConnection::receive(char* data, int length) { + int ret; if ((_ep < 0) || !_is_connected) return -1; @@ -105,7 +118,12 @@ return -1; } } - return picotcp_read(_ep, data, length); + ret = picotcp_read(_ep, data, length); + if (ret < length) { + _ep->revents &= (~PICO_SOCK_EV_RD); + //printf("Short read\n"); + } + return ret; } // -1 if unsuccessful, else number of bytes received