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.

Dependencies:   mbed

Committer:
iva2k
Date:
Sat Jun 12 06:01:50 2010 +0000
Revision:
0:e614f7875b60

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
iva2k 0:e614f7875b60 1 /*
iva2k 0:e614f7875b60 2 * Copyright (c) 2001, Swedish Institute of Computer Science.
iva2k 0:e614f7875b60 3 * All rights reserved.
iva2k 0:e614f7875b60 4 *
iva2k 0:e614f7875b60 5 * Redistribution and use in source and binary forms, with or without
iva2k 0:e614f7875b60 6 * modification, are permitted provided that the following conditions
iva2k 0:e614f7875b60 7 * are met:
iva2k 0:e614f7875b60 8 * 1. Redistributions of source code must retain the above copyright
iva2k 0:e614f7875b60 9 * notice, this list of conditions and the following disclaimer.
iva2k 0:e614f7875b60 10 * 2. Redistributions in binary form must reproduce the above copyright
iva2k 0:e614f7875b60 11 * notice, this list of conditions and the following disclaimer in the
iva2k 0:e614f7875b60 12 * documentation and/or other materials provided with the distribution.
iva2k 0:e614f7875b60 13 * 3. Neither the name of the Institute nor the names of its contributors
iva2k 0:e614f7875b60 14 * may be used to endorse or promote products derived from this software
iva2k 0:e614f7875b60 15 * without specific prior written permission.
iva2k 0:e614f7875b60 16 *
iva2k 0:e614f7875b60 17 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
iva2k 0:e614f7875b60 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
iva2k 0:e614f7875b60 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
iva2k 0:e614f7875b60 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
iva2k 0:e614f7875b60 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
iva2k 0:e614f7875b60 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
iva2k 0:e614f7875b60 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
iva2k 0:e614f7875b60 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
iva2k 0:e614f7875b60 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
iva2k 0:e614f7875b60 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
iva2k 0:e614f7875b60 27 * SUCH DAMAGE.
iva2k 0:e614f7875b60 28 *
iva2k 0:e614f7875b60 29 * This file is part of the lwIP TCP/IP stack.
iva2k 0:e614f7875b60 30 *
iva2k 0:e614f7875b60 31 * Author: Adam Dunkels <adam@sics.se>
iva2k 0:e614f7875b60 32 *
iva2k 0:e614f7875b60 33 */
iva2k 0:e614f7875b60 34 #ifndef __NETIF_SLIPIF_H__
iva2k 0:e614f7875b60 35 #define __NETIF_SLIPIF_H__
iva2k 0:e614f7875b60 36
iva2k 0:e614f7875b60 37 #include "lwip/netif.h"
iva2k 0:e614f7875b60 38
iva2k 0:e614f7875b60 39 #ifdef __cplusplus
iva2k 0:e614f7875b60 40 extern "C" {
iva2k 0:e614f7875b60 41 #endif
iva2k 0:e614f7875b60 42
iva2k 0:e614f7875b60 43 err_t slipif_init(struct netif * netif);
iva2k 0:e614f7875b60 44 void slipif_poll(struct netif *netif);
iva2k 0:e614f7875b60 45
iva2k 0:e614f7875b60 46 #ifdef __cplusplus
iva2k 0:e614f7875b60 47 }
iva2k 0:e614f7875b60 48 #endif
iva2k 0:e614f7875b60 49
iva2k 0:e614f7875b60 50 #endif
iva2k 0:e614f7875b60 51