Some quick code to use UDP-only (no TCP) with mBed. Echos received packets and sends packets when a button is pressed
iputil.h
00001 #ifndef LWIP_UTILS_H 00002 #define LWIP_UTILS_H 00003 00004 #include "ipv4/lwip/ip_addr.h" 00005 00006 #ifdef __cplusplus 00007 extern "C" { 00008 #endif 00009 00010 /** 00011 * This method converts 4 given IPv4 tuples to struct ip_addr classes. 00012 * The Byte are seperated by , 00013 * Does only work with seperated 4 Byte tuple. 00014 */ 00015 inline struct ip_addr IPv4(u8_t ip0, u8_t ip1, u8_t ip2, u8_t ip3) { 00016 struct ip_addr addr; 00017 IP4_ADDR(&addr, ip0, ip1, ip2, ip3); 00018 return addr; 00019 } 00020 00021 unsigned int base64enc_len(const char *str); 00022 00023 void base64enc(const char *input, unsigned int length, char *output); 00024 00025 #ifdef __cplusplus 00026 } 00027 #endif 00028 00029 #endif /* LWIP_UTILS_H */
Generated on Tue Jul 12 2022 19:17:23 by 1.7.2