X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0834112f89c4c5da7864e17e6f483ce296798ce6..53faea431638ee5c0013a2c888215c751fa6437b:/src/common/sckipc.cpp diff --git a/src/common/sckipc.cpp b/src/common/sckipc.cpp index 488ea062ba..c532acbbee 100644 --- a/src/common/sckipc.cpp +++ b/src/common/sckipc.cpp @@ -23,11 +23,12 @@ #pragma hdrstop #endif -#if wxUSE_SOCKETS - #ifndef WX_PRECOMP +#include "wx/defs.h" #endif +#if wxUSE_SOCKETS + #include #include @@ -41,7 +42,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxTCPServer, wxServerBase) IMPLEMENT_DYNAMIC_CLASS(wxTCPClient, wxClientBase) -IMPLEMENT_DYNAMIC_CLASS(wxTCPConnection, wxConnectionBase) +IMPLEMENT_CLASS(wxTCPConnection, wxConnectionBase) // It seems to be already defined somewhere in the Xt includes. #ifndef __XT__ @@ -62,11 +63,16 @@ enum { #endif void Server_OnRequest(wxSocketServer& server, - wxSocketNotify evt, - char *cdata); + wxSocketNotify evt, + char *cdata); void Client_OnRequest(wxSocketBase& sock, - wxSocketNotify evt, - char *cdata); + wxSocketNotify evt, + char *cdata); + + +// All sockets will be created with the following flags + +#define SCKIPC_FLAGS wxSOCKET_NONE // --------------------------------------------------------------------------- // wxTCPClient @@ -92,7 +98,7 @@ wxConnectionBase *wxTCPClient::MakeConnection (const wxString& host, const wxString& server_name, const wxString& topic) { - wxSocketClient *client = new wxSocketClient(); + wxSocketClient *client = new wxSocketClient(SCKIPC_FLAGS); wxSocketStream *stream = new wxSocketStream(*client); wxDataInputStream *data_is = new wxDataInputStream(*stream); wxDataOutputStream *data_os = new wxDataOutputStream(*stream); @@ -164,18 +170,18 @@ wxTCPServer::wxTCPServer () bool wxTCPServer::Create(const wxString& server_name) { - wxIPV4address addr; wxSocketServer *server; - addr.LocalHost(); // GRG + // wxIPV4address defaults to INADDR_ANY:0 + wxIPV4address addr; addr.Service(server_name); // Create a socket listening on specified port - server = new wxSocketServer(addr); + server = new wxSocketServer(addr, SCKIPC_FLAGS); server->Callback((wxSocketBase::wxSockCbk)Server_OnRequest); server->CallbackData((char *)this); server->SetNotify(wxSOCKET_CONNECTION_FLAG); - server->Notify(TRUE); // GRG + server->Notify(TRUE); return TRUE; }