![]() |
UdpTestSocket Class Reference#include <UdpTestSocket.h>
Detailed Description
Definition at line 7 of file UdpTestSocket.h. Constructor & Destructor Documentation
Member Function Documentation
Definition at line 11 of file UdpTestSocket.cpp. 00012 { 00013 if (sa_len == sizeof(struct sockaddr_in)) // IPv4 00014 { 00015 struct sockaddr_in sa; 00016 memcpy(&sa,sa_from,sa_len); 00017 ipaddr_t a; 00018 memcpy(&a,&sa.sin_addr,4); 00019 std::string ip; 00020 Utility::l2ip(a,ip); 00021 printf("Received %d bytes from: %s:%d\n", l,ip.c_str(),ntohs(sa.sin_port)); 00022 printf("%s\n",static_cast<std::string>(p).substr(0,l).c_str()); 00023 } 00024 #ifdef ENABLE_IPV6 00025 #ifdef IPPROTO_IPV6 00026 else 00027 if (sa_len == sizeof(struct sockaddr_in6)) // IPv6 00028 { 00029 struct sockaddr_in6 sa; 00030 memcpy(&sa,sa_from,sa_len); 00031 std::string ip; 00032 Utility::l2ip(sa.sin6_addr,ip); 00033 printf("(IPv6) Received %d bytes from: %s:%d\n", l,ip.c_str(),ntohs(sa.sin6_port)); 00034 printf("%s\n",static_cast<std::string>(p).substr(0,l).c_str()); 00035 } 00036 #endif 00037 #endif 00038 }
The documentation for this class was generated from the following files: |