[wx 271 WinXP VC7.1] Infinite loop in ipc sample Request
Bond, Gary D
gary.d.bond at lmco.com
Fri Nov 17 11:31:14 PST 2006
This is my first posting so I hope I've provided the expected
information. If you need
additional information please let me know.
I have a problem where the application appears to end up in an infinite
loop. In addition,
if you look at the ipc sample program output it never reports any
results from the Request
button. Yet, if using DDE it does.
So this is what I've found so far. Any help would be greatly
appreciated. I've been on
this for two days now.
In the ipc sample program, once I've uncommented out the following line
in the ipc.h file:
#define wxUSE_DDE_FOR_IPC 0
which causes it to use wxTCPConnection, I encounter the problem.
I've looked at the problem extensively and this is what I found. The
following code
snippet shows a call to Read8 (last line). Every time I interrupt the
program in the
debugger it is caught in this loop. I have added a stack trace to the
end of this
message.
/-----------------------------------------------------------------------
--------------
wxChar *wxTCPConnection::Request (const wxString& item, int *size,
wxIPCFormat format)
{
if (!m_sock->IsConnected())
return NULL;
m_codeco->Write8(IPC_REQUEST);
m_codeco->WriteString(item);
m_codeco->Write8(format);
// If Unpack doesn't initialize it.
int ret;
ret = m_codeci->Read8();
/-----------------------------------------------------------------------
--------------
Inside the Read8 call, the wxTCPEventHandler::Client_OnRequest handler
is triggered.
Note that it also makes a Read8 call (shown below). I find that the
code continually
calls the Client_OnRequest handler.
/-----------------------------------------------------------------------
--------------
void wxTCPEventHandler::Client_OnRequest(wxSocketEvent &event)
{
wxSocketBase *sock = event.GetSocket();
wxSocketNotify evt = event.GetSocketEvent();
wxTCPConnection *connection = (wxTCPConnection
*)(sock->GetClientData());
// This socket is being deleted; skip this event
if (!connection)
return;
wxDataInputStream *codeci;
wxDataOutputStream *codeco;
wxSocketStream *sockstrm;
wxString topic_name = connection->m_topic;
wxString item;
// We lost the connection: destroy everything
if (evt == wxSOCKET_LOST)
{
sock->Notify(false);
sock->Close();
connection->OnDisconnect();
return;
}
// Receive message number.
codeci = connection->m_codeci;
codeco = connection->m_codeco;
sockstrm = connection->m_sockstrm;
int msg = codeci->Read8();
/-----------------------------------------------------------------------
--------------
Another call to Read8 is executed. The first time it is called it
returns a value
of 8=IPC_REQUEST_REPLY. But the following switch statement does not
have a case for
that value so it use the default case and executes the following:
/-----------------------------------------------------------------------
--------------
default:
codeco->Write8(IPC_FAIL);
break;
}
/-----------------------------------------------------------------------
--------------
Continuing and repeatedly catching at the same line in the
Client_OnRequest results
in msg having a value of
Value: 18 0 0 0 49 49 47 49 55 47 48 54 32 49 49 58 51 53 58 50 48 0
9 9 9 ...
ASCII: 1 1 / 1 7 / 0 6 sp 1 1 : 3 5 : 2 0 NU
HT HT HT
It is interesting that the Client_OnRequest is receiving the data from
the socket
but the code does not seem to ever exit this loop.
Again, any help would be greatly appreciated. Thanks in advance.
Sincerely,
Gary Bond
/--------------------------Stack
Trace------------------------------------------------
>
wxbase271d_net_vc_custom.dll!wxTCPEventHandler::Client_OnRequest(wxSocke
tEvent & event={...}) Line 557 C++
wxbase271d_vc_custom.dll!wxAppConsole::HandleEvent(wxEvtHandler
* handler=0x00e43cb0, void (wxEvent &)* func=0x004bdce0, wxEvent &
event={...}) Line 337 + 0xc C++
wxbase271d_vc_custom.dll!wxEvtHandler::ProcessEventIfMatches(const
wxEventTableEntryBase & entry={...}, wxEvtHandler * handler=0x00e43cb0,
wxEvent & event={...}) Line 1212 + 0x24 C++
wxbase271d_vc_custom.dll!wxEventHashTable::HandleEvent(wxEvent &
event={...}, wxEvtHandler * self=0x00e43cb0) Line 878 + 0x1c C++
wxbase271d_vc_custom.dll!wxEvtHandler::ProcessEvent(wxEvent &
event={...}) Line 1274 + 0x23 C++
wxbase271d_vc_custom.dll!wxEvtHandler::ProcessPendingEvents()
Line 1167 + 0x11 C++
wxbase271d_vc_custom.dll!wxAppConsole::ProcessPendingEvents()
Line 303 C++
wxmsw271d_core_vc_custom.dll!wxIdleWakeUpModule::MsgHookProc(int
nCode=0, unsigned int wParam=1, long lParam=1241476) Line 6510 + 0x1f
C++
USER32.DLL!77e16333()
USER32.DLL!77e161c1()
USER32.DLL!77e1620f()
NTDLL.DLL!77f9ff57()
USER32.DLL!77e15fa8()
wxmsw271d_core_vc_custom.dll!GetMessage(tagMSG *
lpMsg=0x0012f22c, HWND__ * hWnd=0x00000000, unsigned int
wMsgFilterMin=0, unsigned int wMsgFilterMax=0) Line 307 + 0x18 C++
wxmsw271d_core_vc_custom.dll!wxEventLoop::Dispatch() Line 225 +
0xf C++
wxmsw271d_core_vc_custom.dll!wxAppBase::Dispatch() Line 327 +
0x13 C++
wxmsw271d_core_vc_custom.dll!wxApp::Yield(bool
onlyIfNeeded=true) Line 698 + 0x22 C++
wxbase271d_vc_custom.dll!wxYieldIfNeeded() Line 896 + 0x20
C++
wxbase271d_net_vc_custom.dll!wxSocketBase::_Wait(long
seconds=-1, long milliseconds=0, int flags=9) Line 763 + 0x1e C++
wxbase271d_net_vc_custom.dll!wxSocketBase::WaitForRead(long
seconds=-1, long milliseconds=0) Line 802 C++
wxbase271d_net_vc_custom.dll!wxSocketInputStream::OnSysRead(void
* buffer=0x0012f38f, unsigned int size=1) Line 86 + 0x17 C++
wxbase271d_vc_custom.dll!wxInputStream::Read(void *
buf=0x0012f38f, unsigned int size=1) Line 830 + 0x15 C++
wxbase271d_vc_custom.dll!wxDataInputStream::Read8() Line 85 +
0x17 C++
wxbase271d_net_vc_custom.dll!wxTCPConnection::Request(const
wxString & item={...}, int * size=0x00000000, wxIPCFormat
format=wxIPC_TEXT) Line 419 + 0xe C++
client.exe!MyConnection::Request(const wxString & item={...},
int * size=0x00000000, wxIPCFormat format=wxIPC_TEXT) Line 473 + 0x17
C++
client.exe!MyFrame::OnRequest(wxCommandEvent & __formal={...})
Line 370 + 0x44 C++
wxbase271d_vc_custom.dll!wxAppConsole::HandleEvent(wxEvtHandler
* handler=0x00e43438, void (wxEvent &)* func=0x00404610, wxEvent &
event={...}) Line 337 + 0xc C++
wxbase271d_vc_custom.dll!wxEvtHandler::ProcessEventIfMatches(const
wxEventTableEntryBase & entry={...}, wxEvtHandler * handler=0x00e43438,
wxEvent & event={...}) Line 1212 + 0x24 C++
wxbase271d_vc_custom.dll!wxEventHashTable::HandleEvent(wxEvent &
event={...}, wxEvtHandler * self=0x00e43438) Line 878 + 0x1c C++
wxbase271d_vc_custom.dll!wxEvtHandler::ProcessEvent(wxEvent &
event={...}) Line 1274 + 0x23 C++
wxmsw271d_core_vc_custom.dll!wxWindowBase::TryParent(wxEvent &
event={...}) Line 2503 + 0x1c C++
wxbase271d_vc_custom.dll!wxEvtHandler::ProcessEvent(wxEvent &
event={...}) Line 1287 + 0x11 C++
wxmsw271d_core_vc_custom.dll!wxControl::ProcessCommand(wxCommandEvent &
event={...}) Line 304 + 0x1c C++
wxmsw271d_core_vc_custom.dll!wxButton::SendClickEvent() Line
448 + 0xc C++
wxmsw271d_core_vc_custom.dll!wxButton::MSWCommand(unsigned int
param=0, unsigned short __formal=10007) Line 477 + 0x8 C++
wxmsw271d_core_vc_custom.dll!wxFrame::HandleCommand(unsigned
short id=10007, unsigned short cmd=0, void * control=0x0001168a) Line
894 + 0x1a C++
wxmsw271d_core_vc_custom.dll!wxFrame::MSWWindowProc(unsigned int
message=273, unsigned int wParam=10007, long lParam=71306) Line 996 +
0x16 C++
wxmsw271d_core_vc_custom.dll!wxWndProc(HWND__ * hWnd=0x000e1546,
unsigned int message=273, unsigned int wParam=10007, long lParam=71306)
Line 2475 + 0x1c C++
USER32.DLL!77e11ef0()
USER32.DLL!77e13523()
USER32.DLL!77e139e5()
USER32.DLL!77e2542f()
USER32.DLL!77e244fa()
USER32.DLL!77e23e2a()
wxbase271d_vc_custom.dll!wxEvtHandler::ProcessEvent(wxEvent &
event={...}) Line 1287 + 0x11 C++
wxbase271d_vc_custom.dll!wxEvtHandler::ProcessEvent(wxEvent &
event=) Line 1288 + 0xb C++
Gary Bond
HELIX Operational Analysis & Modeling
Phone: 720-622-5909 Fax: 720-622-5999
Email: gary.d.bond at lmco.com
Lockheed Martin IS&S S
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wx-users/attachments/20061117/722190b7/attachment.htm
More information about the wx-users
mailing list