]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/sckipc.cpp
no message
[wxWidgets.git] / src / common / sckipc.cpp
index 694b94d33697ff4b96590722afcfc3c9716dc3d4..9034bc595b019c4b539ffa0403dfd3ae43d2faa5 100644 (file)
@@ -60,22 +60,22 @@ enum {
 #endif
 
 void Server_OnRequest(wxSocketServer& server,
-                     wxSocketBase::wxRequestEvent evt,
+                     wxSocketNotify evt,
                      char *cdata);
 void Client_OnRequest(wxSocketBase& sock,
-                     wxSocketBase::wxRequestEvent evt,
+                     wxSocketNotify evt,
                      char *cdata);
 
 // ---------------------------------------------------------------------------
 // wxTCPClient
 // ---------------------------------------------------------------------------
 
-wxTCPClient::wxTCPClient (void)
+wxTCPClient::wxTCPClient ()
   : wxClientBase()
 {
 }
 
-wxTCPClient::~wxTCPClient (void)
+wxTCPClient::~wxTCPClient ()
 {
 }
 
@@ -91,13 +91,12 @@ wxConnectionBase *wxTCPClient::MakeConnection (const wxString& host,
                                                const wxString& topic)
 {
   wxIPV4address addr;
-  wxSocketHandler *hsock = &wxSocketHandler::Master();
-  wxSocketClient *client = hsock->CreateClient();
+  wxSocketClient *client = new wxSocketClient();
   wxSocketStream *stream = new wxSocketStream(*client);
   wxDataInputStream data_is(*stream);
   wxDataOutputStream data_os(*stream);
   
-  client->SetNotify(wxSocketBase::REQ_READ | wxSocketBase::REQ_LOST);
+  client->SetNotify(wxSOCKET_INPUT_FLAG | wxSOCKET_LOST_FLAG);
   addr.Service(server_name);
   addr.Hostname(host);
 
@@ -148,7 +147,7 @@ wxConnectionBase *wxTCPClient::OnMakeConnection()
 // wxTCPServer
 // ---------------------------------------------------------------------------
 
-wxTCPServer::wxTCPServer (void)
+wxTCPServer::wxTCPServer ()
   : wxServerBase()
 {
 }
@@ -156,22 +155,21 @@ wxTCPServer::wxTCPServer (void)
 bool wxTCPServer::Create(const wxString& server_name)
 {
   wxIPV4address addr;
-  wxSocketHandler *hsock = &wxSocketHandler::Master();
   wxSocketServer *server;
 
   addr.Service(server_name);
 
   // Create a socket listening on specified port
-  server = hsock->CreateServer(addr);
+  server = new wxSocketServer(addr);
   server->Callback((wxSocketBase::wxSockCbk)Server_OnRequest);
-  server->SetNotify(wxSocketBase::REQ_ACCEPT);
+  server->SetNotify(wxSOCKET_CONNECTION_FLAG);
 
   server->CallbackData((char *)this);
 
   return TRUE;
 }
 
-wxTCPServer::~wxTCPServer(void)
+wxTCPServer::~wxTCPServer()
 {
 }
 
@@ -184,17 +182,17 @@ wxConnectionBase *wxTCPServer::OnAcceptConnection( const wxString& WXUNUSED(topi
 // wxTCPConnection
 // ---------------------------------------------------------------------------
 
-wxTCPConnection::wxTCPConnection (void)
+wxTCPConnection::wxTCPConnection ()
   : wxConnectionBase(),
     m_sock(NULL), m_sockstrm(NULL), m_codeci(NULL), m_codeco(NULL)
 {
 }
 
-wxTCPConnection::wxTCPConnection(char *buffer, int size)
+wxTCPConnection::wxTCPConnection(char * WXUNUSED(buffer), int WXUNUSED(size))
 {
 }
 
-wxTCPConnection::~wxTCPConnection (void)
+wxTCPConnection::~wxTCPConnection ()
 {
   wxDELETE(m_sock);
   wxDELETE(m_codeci);
@@ -208,7 +206,7 @@ void wxTCPConnection::Compress(bool WXUNUSED(on))
 }
 
 // Calls that CLIENT can make.
-bool wxTCPConnection::Disconnect (void)
+bool wxTCPConnection::Disconnect ()
 {
   // Send the the disconnect message to the peer.
   m_codeco->Write8(IPC_DISCONNECT);
@@ -217,7 +215,7 @@ bool wxTCPConnection::Disconnect (void)
   return TRUE;
 }
 
-bool wxTCPConnection::Execute (wxChar *data, int size, wxIPCFormat format)
+bool wxTCPConnection::Execute (const wxChar *data, int size, wxIPCFormat format)
 {
   if (!m_sock->IsConnected())
     return FALSE;
@@ -338,7 +336,7 @@ bool wxTCPConnection::Advise (const wxString& item,
   return TRUE;
 }
 
-void Client_OnRequest(wxSocketBase& sock, wxSocketBase::wxRequestEvent evt,
+void Client_OnRequest(wxSocketBase& sock, wxSocketNotify evt,
                      char *cdata)
 {
   int msg = 0;
@@ -350,7 +348,7 @@ void Client_OnRequest(wxSocketBase& sock, wxSocketBase::wxRequestEvent evt,
   wxString item;
 
   // The socket handler signals us that we lost the connection: destroy all.
-  if (evt == wxSocketBase::EVT_LOST) {
+  if (evt == wxSOCKET_LOST) {
     sock.Close();
     connection->OnDisconnect();
     return;
@@ -466,20 +464,20 @@ void Client_OnRequest(wxSocketBase& sock, wxSocketBase::wxRequestEvent evt,
 }
 
 void Server_OnRequest(wxSocketServer& server,
-                     wxSocketBase::wxRequestEvent evt, char *cdata)
+                     wxSocketNotify evt, char *cdata)
 {
   wxTCPServer *ipcserv = (wxTCPServer *)cdata;
   wxSocketStream *stream;
   wxDataInputStream *codeci;
   wxDataOutputStream *codeco;
 
-  if (evt != wxSocketBase::EVT_ACCEPT)
+  if (evt != wxSOCKET_CONNECTION)
     return;
 
   /* Accept the connection, getting a new socket */
   wxSocketBase *sock = server.Accept();
   sock->Notify(FALSE);
-  sock->SetNotify(wxSocketBase::REQ_READ | wxSocketBase::REQ_LOST);
+  sock->SetNotify(wxSOCKET_INPUT_FLAG | wxSOCKET_LOST_FLAG);
 
   stream = new wxSocketStream(*sock);
   codeci = new wxDataInputStream(*stream);