git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16928
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DDE_H_
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DDE_H_
{
DECLARE_DYNAMIC_CLASS(wxDDEConnection)
public:
{
DECLARE_DYNAMIC_CLASS(wxDDEConnection)
public:
- wxDDEConnection(char *buffer, int size);
- wxDDEConnection(void);
+ wxDDEConnection(char *buffer, int size); // use external buffer
+ wxDDEConnection(); // use internal buffer
~wxDDEConnection(void);
// Calls that CLIENT can make
~wxDDEConnection(void);
// Calls that CLIENT can make
virtual bool OnDisconnect(void);
public:
virtual bool OnDisconnect(void);
public:
wxDDEServer* m_server;
wxDDEClient* m_client;
wxDDEServer* m_server;
wxDDEClient* m_client;
-wxTCPConnection::wxTCPConnection(char * WXUNUSED(buffer), int WXUNUSED(size))
+wxTCPConnection::wxTCPConnection(wxChar *buffer, int size)
+ : wxConnectionBase(buffer, size)
+ m_sock = NULL;
+ m_sockstrm = NULL;
+ m_codeci = NULL;
+ m_codeco = NULL;
}
wxTCPConnection::~wxTCPConnection ()
{
}
wxTCPConnection::~wxTCPConnection ()
{
wxDELETE(m_codeci);
wxDELETE(m_codeco);
wxDELETE(m_sockstrm);
wxDELETE(m_codeci);
wxDELETE(m_codeco);
wxDELETE(m_sockstrm);
// Calls that CLIENT can make.
bool wxTCPConnection::Disconnect ()
{
// Calls that CLIENT can make.
bool wxTCPConnection::Disconnect ()
{
+ if ( !GetConnected() )
+ return TRUE;
// Send the the disconnect message to the peer.
m_codeco->Write8(IPC_DISCONNECT);
m_sock->Notify(FALSE);
m_sock->Close();
// Send the the disconnect message to the peer.
m_codeco->Write8(IPC_DISCONNECT);
m_sock->Notify(FALSE);
m_sock->Close();
+ wxChar *data = GetBufferAtLeast( s );
+ wxASSERT_MSG(data != NULL,
+ _T("Buffer too small in wxTCPConnection::Request") );
m_sockstrm->Read(data, s);
if (size)
m_sockstrm->Read(data, s);
if (size)
format = (wxIPCFormat)codeci->Read8();
size = codeci->Read32();
format = (wxIPCFormat)codeci->Read8();
size = codeci->Read32();
+ data = connection->GetBufferAtLeast( size );
+ wxASSERT_MSG(data != NULL,
+ _T("Buffer too small in wxTCPEventHandler::Client_OnRequest") );
sockstrm->Read(data, size);
connection->OnExecute (topic_name, data, size, format);
sockstrm->Read(data, size);
connection->OnExecute (topic_name, data, size, format);
break;
}
case IPC_ADVISE:
break;
}
case IPC_ADVISE:
item = codeci->ReadString();
format = (wxIPCFormat)codeci->Read8();
size = codeci->Read32();
item = codeci->ReadString();
format = (wxIPCFormat)codeci->Read8();
size = codeci->Read32();
+ data = connection->GetBufferAtLeast( size );
+ wxASSERT_MSG(data != NULL,
+ _T("Buffer too small in wxTCPEventHandler::Client_OnRequest") );
sockstrm->Read(data, size);
connection->OnAdvise (topic_name, item, data, size, format);
sockstrm->Read(data, size);
connection->OnAdvise (topic_name, item, data, size, format);
break;
}
case IPC_ADVISE_START:
break;
}
case IPC_ADVISE_START:
item = codeci->ReadString();
format = (wxIPCFormat)codeci->Read8();
size = codeci->Read32();
item = codeci->ReadString();
format = (wxIPCFormat)codeci->Read8();
size = codeci->Read32();
- data = new wxChar[size];
+ data = connection->GetBufferAtLeast( size );
+ wxASSERT_MSG(data != NULL,
+ _T("Buffer too small in wxTCPEventHandler::Client_OnRequest") );
sockstrm->Read(data, size);
connection->OnPoke (topic_name, item, data, size, format);
sockstrm->Read(data, size);
connection->OnPoke (topic_name, item, data, size, format);
break;
}
case IPC_REQUEST:
break;
}
case IPC_REQUEST:
{
sock->Notify(FALSE);
sock->Close();
{
sock->Notify(FALSE);
sock->Close();
+ connection->SetConnected(false);
connection->OnDisconnect();
break;
}
connection->OnDisconnect();
break;
}