A version of LWIP, provided for backwards compatibility.

Dependents:   AA_DemoBoard DemoBoard HelloServerDemo DemoBoard_RangeIndicator ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers tcplistener.cpp Source File

tcplistener.cpp

00001 #include "tcplistener.h"
00002 
00003 using namespace std;
00004 using namespace mbed;
00005 
00006 err_t tcp_connection_accept_callback(void *arg, struct tcp_pcb *newpcb, err_t err) {
00007   TCPListener *listener   = static_cast<TCPListener *>(arg);
00008   return (listener->accept)(newpcb, err);
00009 }
00010 
00011 void TCPListener::bind() {
00012   if(tcp_bind(this->_pcb, IP_ADDR_ANY, this->_port) == ERR_OK) {
00013     this->_pcb = tcp_listen(this->_pcb);
00014     tcp_accept(this->_pcb, tcp_connection_accept_callback);
00015   }
00016 }