+ 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;
+ }
+
+ if ( sock.SendTo(addr, buf, n).LastCount() != n )
+ {
+ wxLogMessage("ERROR: failed to send data");
+ return;
+ }
+}
+
+void MyFrame::OnWaitForAccept(wxCommandEvent& WXUNUSED(event))
+{
+ TestLogger logtest("WaitForAccept() test");
+
+ wxBusyInfo("Waiting for connection for 10 seconds...", this);
+ if ( m_server->WaitForAccept(10) )
+ wxLogMessage("Accepted client connection.");
+ else
+ wxLogMessage("Connection error or timeout expired.");
+}
+
+void MyFrame::Test1(wxSocketBase *sock)
+{
+ TestLogger logtest("Test 1");