]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/sockets/baseserver.cpp
regenerated
[wxWidgets.git] / samples / sockets / baseserver.cpp
index 047327d03c5e93c9c44750a0e52edc2ce90167f5..ae30bce692274a36b2c8e9cb3bff1d45033c3fe0 100644 (file)
@@ -101,7 +101,7 @@ WX_DECLARE_LIST(EventWorker, EList);
 //and list of two type worker classes that serve clients
 class Server : public wxApp
 {
 //and list of two type worker classes that serve clients
 class Server : public wxApp
 {
-    DECLARE_EVENT_TABLE();
+    DECLARE_EVENT_TABLE()
 public:
     Server() : m_maxConnections(-1) {}
     ~Server() {}
 public:
     Server() : m_maxConnections(-1) {}
     ~Server() {}
@@ -198,7 +198,7 @@ private:
     void DoWrite();
     void DoRead();
 
     void DoWrite();
     void DoRead();
 
-    DECLARE_EVENT_TABLE();
+    DECLARE_EVENT_TABLE()
 };
 
 /******************* Implementation ******************/
 };
 
 /******************* Implementation ******************/
@@ -598,7 +598,7 @@ EventWorker::DoRead()
         //read message header
         do
         {
         //read message header
         do
         {
-            m_socket->Read(m_signature,2 - m_infill);
+            m_socket->Read(m_signature + m_infill, 2 - m_infill);
             if (m_socket->Error())
             {
                 if (m_socket->LastError() != wxSOCKET_WOULDBLOCK)
             if (m_socket->Error())
             {
                 if (m_socket->LastError() != wxSOCKET_WOULDBLOCK)
@@ -630,7 +630,8 @@ EventWorker::DoRead()
                         m_written = 0;
                         LogWorker(wxString::Format("Message signature: len: %d, type: %s, size: %d (bytes)",chunks,type == 0xBE ? "b" : "kB",m_size));
                         break;
                         m_written = 0;
                         LogWorker(wxString::Format("Message signature: len: %d, type: %s, size: %d (bytes)",chunks,type == 0xBE ? "b" : "kB",m_size));
                         break;
-                    } else
+                    }
+                    else
                     {
                         LogWorker(wxString::Format("Unknown test type %x",type));
                         m_socket->Close();
                     {
                         LogWorker(wxString::Format("Unknown test type %x",type));
                         m_socket->Close();
@@ -687,17 +688,17 @@ void EventWorker::OnSocketEvent(wxSocketEvent& pEvent)
             break;
 
         case wxSOCKET_OUTPUT:
             break;
 
         case wxSOCKET_OUTPUT:
-            if (m_inbuf != NULL)
+            if ( m_outbuf )
                 DoWrite();
             break;
 
         case wxSOCKET_CONNECTION:
                 DoWrite();
             break;
 
         case wxSOCKET_CONNECTION:
-            LogWorker(wxString::Format("Unexpected wxSOCKET_CONNECTION in EventWorker"),wxLOG_Error);
+            LogWorker("Unexpected wxSOCKET_CONNECTION in EventWorker", wxLOG_Error);
             break;
 
         case wxSOCKET_LOST:
             {
             break;
 
         case wxSOCKET_LOST:
             {
-                LogWorker(wxString::Format("Connection lost"));
+                LogWorker("Connection lost");
                 WorkerEvent e(this);
                 e.m_workerFailed = m_written != m_size;
                 wxGetApp().AddPendingEvent(e);
                 WorkerEvent e(this);
                 e.m_workerFailed = m_written != m_size;
                 wxGetApp().AddPendingEvent(e);