#pragma hdrstop
#endif
-#if wxUSE_SOCKETS
-
#ifndef WX_PRECOMP
+#include "wx/defs.h"
#endif
+#if wxUSE_SOCKETS
+
#include <stdlib.h>
#include <stdio.h>
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__
#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
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);
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;
}