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 RTOS
  • generic mbed Ethernet driver
  • high performance NXP LPC1768 specific Ethernet driver
  • Multi-threading support for mbed RTOS
  • Berkeley sockets and integration with the New Socket API
  • Fork of the apps running on top of the New Socket API
  • Scheduling 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.

Files at this revision

API Documentation at this revision

Comitter:
tass
Date:
Thu Jan 28 15:12:00 2016 +0100
Parent:
154:6c0e92a80c4a
Commit message:
Adding TCP flag for FIN.

Changed in this revision

Socket/bsd/stack_endpoint.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Socket/bsd/stack_endpoint.cpp	Mon Sep 28 14:14:17 2015 +0200
+++ b/Socket/bsd/stack_endpoint.cpp	Thu Jan 28 15:12:00 2016 +0100
@@ -11,6 +11,7 @@
 #include "mbed.h"
 #include "Socket.h"
 #include "Mutex.h"
+//#include "PicoTerm.h"
 
 extern "C"
 {
@@ -19,7 +20,7 @@
     #include "pico_dhcp_server.h"
 }
 
-//#define ptsock_dbg mbed_dbg
+//#define ptsock_dbg ptm_dbg
 #define ptsock_dbg(...)
 #define SCHEDULER_BASE  4u
 #define SCHEDULER_MAX   10
@@ -44,17 +45,20 @@
 static inline int __critical_select(struct stack_endpoint *ep, uint32_t time, uint8_t lock)
 {
   uint32_t in_time = PICO_TIME_MS();
-  
+  ptsock_dbg("Critical_select on endpoint.\n");
   if(lock) PicoTcpLock->unlock();
   while ((ep->events & ep->revents) == 0) {
     ep->queue->get(time);
+    ptsock_dbg("In while loop.\n");
     if ((time != osWaitForever) && (PICO_TIME_MS() > in_time + time)) {
         ptsock_dbg("TIMEOUT in critical select... (ev:%04x rev:%04x \n", ep->events, ep->revents);
         if(lock) PicoTcpLock->lock();
         return 0;
     }
   }
+  ptsock_dbg("After while loop.\n");
   if(lock) PicoTcpLock->lock();
+  ptsock_dbg("After while loop, returning now.\n");
   return 1;
 }
 
@@ -73,6 +77,8 @@
     return;
   }
 
+  ptsock_dbg("RECEIVED EVENT: %d\n",ev);
+
   ep->revents |= ev;
     
   if(ev & PICO_SOCK_EV_ERR)
@@ -86,6 +92,7 @@
     }
   }
   if ((ev & PICO_SOCK_EV_CLOSE) || (ev & PICO_SOCK_EV_FIN)) {
+    ptsock_dbg("GOT FIN or CLOSE event.\n");
     ep->connected = 0;
     pico_socket_close(ep->s);
     ep->s->priv = NULL;
@@ -160,7 +167,8 @@
   srv_addr = (struct sockaddr_in *)_srv_addr;
   PicoTcpLock->lock();
   pico_socket_connect(ep->s, (struct pico_ip4 *)(&srv_addr->sin_addr.s_addr), srv_addr->sin_port);
-  ep->events = PICO_SOCK_EV_CONN | PICO_SOCK_EV_ERR;
+  ep->events = PICO_SOCK_EV_CONN | PICO_SOCK_EV_ERR | PICO_SOCK_EV_FIN;
+  ptsock_dbg("Going to perform cirital_select on endpoint.\n");
   __critical_select(ep, osWaitForever, 1);
   if ((ep->revents & PICO_SOCK_EV_CONN) && ep->connected) {
     ep->revents &= (~PICO_SOCK_EV_CONN);
@@ -171,6 +179,7 @@
   } else {
     retval = -1;
   }
+  ptsock_dbg("Returning %d from picotcp_connect.\n", retval);
   PicoTcpLock->unlock();
   return retval;
 }