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_http_server.c
- Revision:
- 63:97f481e33cb2
- Parent:
- 51:ab4529a384a6
diff -r 357cc2460285 -r 97f481e33cb2 modules/pico_http_server.c --- a/modules/pico_http_server.c Mon Sep 16 12:07:35 2013 +0000 +++ b/modules/pico_http_server.c Thu Sep 19 12:38:53 2013 +0000 @@ -22,21 +22,21 @@ #define consumeChar(c) (pico_socket_read(client->sck,&c,1u)) -static const char returnOkHeader[] = +static char returnOkHeader[] = "HTTP/1.1 200 OK\r\n\ Host: localhost\r\n\ Transfer-Encoding: chunked\r\n\ Connection: close\r\n\ \r\n"; -static const char returnFailHeader[] = +static char returnFailHeader[] = "HTTP/1.1 404 Not Found\r\n\ Host: localhost\r\n\ Connection: close\r\n\ \r\n\ <html><body>The resource you requested cannot be found !</body></html>"; -static const char errorHeader[] = +static char errorHeader[] = "HTTP/1.1 400 Bad Request\r\n\ Host: localhost\r\n\ Connection: close\r\n\ @@ -73,7 +73,7 @@ #define HTTP_ERROR 6 #define HTTP_CLOSED 7 -static struct httpServer server = {0}; +static struct httpServer server = {}; /* * Private functions @@ -124,7 +124,7 @@ { // send out error client->state = HTTP_ERROR; - pico_socket_write(client->sck,(char *)errorHeader,sizeof(errorHeader)-1); + pico_socket_write(client->sck,errorHeader,sizeof(errorHeader)-1); server.wakeup(EV_HTTP_ERROR,client->connectionID); } } @@ -164,7 +164,7 @@ */ int pico_http_server_start(uint16_t port, void (*wakeup)(uint16_t ev, uint16_t conn)) { - struct pico_ip4 anything = {0}; + struct pico_ip4 anything = {}; server.port = port ? short_be(port) : short_be(80u); @@ -288,13 +288,13 @@ if(code == HTTP_RESOURCE_FOUND) { client->state = HTTP_WAIT_DATA; - return pico_socket_write(client->sck,(char *)returnOkHeader,sizeof(returnOkHeader)-1);//remove \0 + return pico_socket_write(client->sck,returnOkHeader,sizeof(returnOkHeader)-1);//remove \0 } else { int length; - length = pico_socket_write(client->sck,(char *)returnFailHeader,sizeof(returnFailHeader)-1);//remove \0 + length = pico_socket_write(client->sck,returnFailHeader,sizeof(returnFailHeader)-1);//remove \0 pico_socket_close(client->sck); client->state = HTTP_CLOSED; return length; @@ -485,7 +485,7 @@ { // possible GET char line[HTTP_HEADER_MAX_LINE]; - uint32_t index = 0; + int index = 0; line[index] = c; @@ -496,7 +496,7 @@ if(c == '\n') break; - if(index >= HTTP_HEADER_MAX_LINE) + if(index >= HTTP_HEADER_MAX_LINE) { dbg("Size exceeded \n"); return HTTP_RETURN_ERROR;