Some quick code to use UDP-only (no TCP) with mBed. Echos received packets and sends packets when a button is pressed
TCPItem.h
00001 #ifndef TCPITEM_H 00002 #define TCPITEM_H 00003 00004 #include "arch/cc.h" 00005 #include "lwip/err.h" 00006 #include "lwip/tcp.h" 00007 00008 namespace mbed { 00009 class NetServer; 00010 00011 /** 00012 * A simple object which provides the base for all TCP enabled objects. 00013 * Do not ues it directly unless you know what you doing. 00014 * Normaly what you want to use is TCPListener or TCPConnector. 00015 */ 00016 class TCPItem { 00017 public: 00018 TCPItem() : _pcb(NULL) {} 00019 TCPItem(struct tcp_pcb *pcb) : _pcb(pcb) {} 00020 virtual ~TCPItem() {} 00021 00022 void abort() const; 00023 void release_callbacks() const; 00024 err_t close(); 00025 void open(); 00026 protected: 00027 struct tcp_pcb *_pcb; 00028 }; 00029 00030 }; 00031 00032 #endif /* TCPITEM_H */
Generated on Tue Jul 12 2022 19:17:24 by 1.7.2