Description: 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.
ip_addr.c File Reference
This is the IPv4 address tools implementation. More...
Go to the source code of this file.
Functions | |
| u8_t | ip_addr_isbroadcast (ip_addr_t *addr, struct netif *netif) |
| Determine if an address is a broadcast address on a network interface. | |
| u32_t | ipaddr_addr (const char *cp) |
| Ascii internet address interpretation routine. | |
| int | ipaddr_aton (const char *cp, ip_addr_t *addr) |
| Check whether "cp" is a valid ascii representation of an Internet address and convert to a binary address. | |
| char * | ipaddr_ntoa (ip_addr_t *addr) |
| Convert numeric IP address into decimal dotted ASCII representation. | |
| char * | ipaddr_ntoa_r (ip_addr_t *addr, char *buf, int buflen) |
| Same as ipaddr_ntoa, but reentrant since a user-supplied buffer is used. | |
Detailed Description
This is the IPv4 address tools implementation.
Definition in file ip_addr.c.
Function Documentation
| u8_t ip_addr_isbroadcast | ( | ip_addr_t * | addr, |
| struct netif * | netif | ||
| ) |
| u32_t ipaddr_addr | ( | const char * | cp ) |
| int ipaddr_aton | ( | const char * | cp, |
| ip_addr_t * | addr | ||
| ) |
Check whether "cp" is a valid ascii representation of an Internet address and convert to a binary address.
Returns 1 if the address is valid, 0 if not. This replaces inet_addr, the return value from which cannot distinguish between failure and a local broadcast address.
- Parameters:
-
cp IP address in ascii represenation (e.g. "127.0.0.1") addr pointer to which to save the ip address in network order
- Returns:
- 1 if cp could be converted to addr, 0 on failure
| char* ipaddr_ntoa | ( | ip_addr_t * | addr ) |
Convert numeric IP address into decimal dotted ASCII representation.
returns ptr to static buffer; not reentrant!
returns ptr to static buffer; not reentrant!
- Parameters:
-
addr ip address in network order to convert
- Returns:
- pointer to a global static (!) buffer that holds the ASCII represenation of addr
| char* ipaddr_ntoa_r | ( | ip_addr_t * | addr, |
| char * | buf, | ||
| int | buflen | ||
| ) |
Same as ipaddr_ntoa, but reentrant since a user-supplied buffer is used.
- Parameters:
-
addr ip address in network order to convert buf target buffer where the string is stored buflen length of buf
- Returns:
- either pointer to buf which now holds the ASCII representation of addr or NULL if buf was too small
