+ TestLogger logtest("UDP test");
+
+ IPaddress addr;
+ addr.Service(3000);
+ wxDatagramSocket sock(addr);
+
+ char buf[1024];
+ size_t n = sock.RecvFrom(addr, buf, sizeof(buf)).LastCount();
+ if ( !n )
+ {
+ wxLogMessage("ERROR: failed to receive data");
+ return;
+ }
+
+ wxLogMessage("Received \"%s\" from %s:%u.",
+ wxString::From8BitData(buf, n),
+ addr.IPAddress(), addr.Service());
+
+ for ( size_t i = 0; i < n; i++ )
+ {
+ char& c = buf[i];
+ if ( (c >= 'A' && c <= 'M') || (c >= 'a' && c <= 'm') )
+ c += 13;
+ else if ( (c >= 'N' && c <= 'Z') || (c >= 'n' && c <= 'z') )
+ c -= 13;
+ }