Port of LwIP performed by Ralf in 2010. Not recommended for use with recent mbed libraries, but good demos of raw LwIP possible

Dependents:   LwIP_raw_API_serverExample tiny-dtls

Revision:
0:0791c1fece8e
diff -r 000000000000 -r 0791c1fece8e Core/TCPListener.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Core/TCPListener.cpp	Tue Sep 18 14:41:24 2012 +0000
@@ -0,0 +1,23 @@
+#include "TCPListener.h"
+#include "NetServer.h"
+
+using namespace std;
+using namespace mbed;
+
+err_t TCPListener::accept_callback(void *arg, struct tcp_pcb *newpcb, err_t err) {
+  TCPListener *listener   = static_cast<TCPListener *>(arg);
+  if(listener) {
+    return (listener->accept)(newpcb, err);
+  }
+  return ERR_OK;
+}
+
+void TCPListener::bind() {
+  NetServer::ready();
+  open();
+  tcp_arg(this->_pcb, static_cast<void *>(this));
+  if(tcp_bind(this->_pcb, IP_ADDR_ANY, this->_port) == ERR_OK) {
+    this->_pcb = tcp_listen(this->_pcb);
+    tcp_accept(this->_pcb, TCPListener::accept_callback);
+  }
+}