I'm writing an app (on Win32) that is divided into two different programs.
The first must run likes a service: it communicate with an external electronic equipment through serial line and shows only an icon on the tray in order to signal the communication state.
The second is GUI based and shows the data read on the serial line by the first app. Multiple instance of this app should run together on a windows terminal services server.
So i need to implement an IPC solution to make multiple copies of the second app comunicate with the first.
I have first tried wxSocket and then wxTCP... but with both the server side die with the assert "wxYield called recursively" when I open a second copy of the GUI app.
The strange things is that if I use wxDDE... all works well but sadly I can't use it because it does not work through different user account...

Any suggestion will be very appreciated!!
Thanks very much,
Francesco
Following is my server side code:
Code: Select all
class myConnection : public wxTCPConnection {
public:
myConnection() : wxConnection {};
virtual wxChar *OnRequest(const wxString& topic, const wxString& item, int *size, wxIPCFormat format);
virtual bool OnPoke(const wxString& topic, const wxString& item, wxChar *data, int size, wxIPCFormat format);
protected:
BYTE bufferTX[10000];
BYTE bufferRX[10000];
private:
int InviaMsgStato9910();
int InviaMsgStato9130();
int InviaInformazioniSw();
int InviaInformazioniDistinte();
void RiceviModificaDistinta();
void RiceviRicettaManuale();
};
class SerialServer : wxTCPServer {
public:
SerialServer() { m_connection= NULL; }
~SerialServer() {
if (m_connection)
m_connection = NULL;
}
bool IsConnected() { return m_connection != NULL; };
myConnection *GetConnection() { return m_connection; };
wxConnectionBase *OnAcceptConnection(const wxString& topic) {
if ( topic == "Tecna_DDE_Client" )
{
m_connection = new CConnection();
return m_connection;
}
return NULL;
}
protected:
myConnection *m_connection;
};
bool myConnection::OnPoke(const wxString& topic,
const wxString& item, wxChar *data, int size, wxIPCFormat format)
{
memcpy(&bufferRX[0], (void*)data, size);
if (item == "MOD_DISTINTA")
RiceviModificaDistinta();
else if (item == "MOD_RICETTA")
RiceviRicettaManuale();
return wxConnection::OnPoke(topic, item, data, size, format);
}
wxChar *myConnection::OnRequest(const wxString& topic,
const wxString& item, int * size, wxIPCFormat format)
{
int i;
wxString num;
if (item == "INFO_SW")
*size = InviaInformazioniSw();
else if (item.Left(6) == "STATOB")
*size = InviaMsgStato9910();
else if (item.Left(6) == "STATOE")
*size = InviaMsgStato9130();
else if (item.Left(4) == "DIST")
*size = InviaInformazioniDistinte();
else
*size = 0;
dentro = false;
return (char*)&bufferTX[0];
}