Example program with HTTPServer and sensor data streaming over TCPSockets, using Donatien Garnier's Net APIs and services code on top of LWIP. Files StreamServer.h and .cpp encapsulate streaming over TCPSockets. Broadcast is done by sendToAll(), and all incoming data is echoed back to the client. Echo code can be replaced with some remote control of the streaming interface. See main() that shows how to periodically send some data to all subscribed clients. To subscribe, a client should open a socket at <mbed_ip> port 123. I used few lines in TCL code to set up a quick sink for the data. HTTP files are served on port 80 concurrently to the streaming.
netCfg.h
00001 #ifndef NET_CFG_H 00002 #define NET_CFG_H 1 00003 00004 //#define __LWIP_DEBUG 00005 #define __DEBUG 00006 00007 //Configure build params for TCP/IP Stack 00008 00009 //Build GPRS Module (eg Telit Module) If 00010 #define NET_GPRS 0 00011 00012 #define NET_TELIT 0 00013 #define NET_TELIT_STACK 0 00014 00015 //Build PPP If 00016 #define NET_PPP 0 00017 #define NET_ZG2100 0 00018 00019 //Build Usb Host Stack 00020 #define NET_USB 0 00021 00022 //Build Usb Virtual Serial Port 00023 #define NET_USB_SERIAL 0 00024 00025 //Build Ethernet If 00026 //iva2k ?#define NET_ETH 0 00027 #define NET_ETH 1 00028 00029 //Build LWIP Stack 00030 //iva2k ?#define NET_LWIP_STACK 0 00031 #define NET_LWIP_STACK 1 00032 00033 #endif
Generated on Tue Jul 12 2022 21:10:25 by 1.7.2