wxServer/Client issues

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Veni_Vidi_Exi
In need of some credit
In need of some credit
Posts: 7
Joined: Thu Aug 18, 2005 8:29 pm

wxServer/Client issues

Post by Veni_Vidi_Exi »

Cheesy Disclaimer: I've been using wxWidgets for only a few days now, so I'm still getting familiar with the components.

I am trying to develop a system where several applications communicate with each other over a central data exchange. I want to use wxServer as the exchange and have a bunch of wxClient objects in my applications. The clients can both send and recieve information of various types by sending it to the server. I want to do this asychronously, so my clients may not be ready for data when they recieve it.

I have a couple of issues:

First, is their any way to avoid the errors caused when a client is executing one "Connection::OnAdvise()" call and another Advise() is performed by the server? Same for other methods, like Poke(). I notice that they all time out really fast.

Second, I want my final product to use TCP/IP, not DDE. I know that to do this you need to use

#define wxUSE_DDE_FOR_IPC 0

However, when I do this, my initial connection is never even made. Are there other settings, or has anyone else had issues like this before? I am using Windows XP SP2, if that could be somehow blocking. Firewall is off (of course).

I'd appreciate any advice.
Last edited by Veni_Vidi_Exi on Thu Aug 18, 2005 8:56 pm, edited 1 time in total.
- I came, I saw, I left.
geon
I live to help wx-kind
I live to help wx-kind
Posts: 189
Joined: Tue Sep 07, 2004 4:10 pm
Location: Sweden, Uppsala

Post by geon »

Why not just use a normal socket and connect to localhost?
Veni_Vidi_Exi
In need of some credit
In need of some credit
Posts: 7
Joined: Thu Aug 18, 2005 8:29 pm

Post by Veni_Vidi_Exi »

Hmmm, I didn't notice some of the extra functionality of SocketBase. But the docs say you shouldn't create one directly? Ah, I'll try it.

Still, though, TCP/IP should get through. Has anyone running XP out there had issues with it? I set the flag for DDE and everything is fine, but set it for TCP and no connections are ever made.
- I came, I saw, I left.
upCASE
Moderator
Moderator
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Post by upCASE »

Veni_Vidi_Exi wrote:Hmmm, I didn't notice some of the extra functionality of SocketBase. But the docs say you shouldn't create one directly? Ah, I'll try it.

Still, though, TCP/IP should get through. Has anyone running XP out there had issues with it? I set the flag for DDE and everything is fine, but set it for TCP and no connections are ever made.
The docs are right on this, you shouldn't create a wxSocketBase yourself. Use wxSocketServer and wxSocketClient instead. But, using wxSocketServer::Accept() you'll get a wxSocketBase instance, representing the client endpoint.

Although I strongly suggest using the socket classes, here's one thing you could try:
Use wxTCPServer and wxTCPClient directly instead of letting wxWidgets choose which one to take by using wxServer and wxClient. You may have to include wx/sckipc.h for that.
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
toxicBunny
Super wx Problem Solver
Super wx Problem Solver
Posts: 424
Joined: Tue Jul 12, 2005 8:44 pm
Location: Alabama, USA

Post by toxicBunny »

I just wanted to say that I've had issues using TCP with the IPC classes on XP. I have an application that uses DDE for IPC, and everything works as expected. If I set

Code: Select all

#define wxUSE_DDE_FOR_IPC 0
the initial connection appears to be made from the client side, but it hangs using 100% of the CPU as soon as it tries to write to the socket stream. I haven't had time to debug this and only a Windows version of my application is required at the moment. However, it would be good to determine why there are issues using TCP with the IPC classes under Windows.

-Scott
nobes
Earned a small fee
Earned a small fee
Posts: 12
Joined: Wed Mar 16, 2005 12:40 am

Post by nobes »

I have to say that after playing with wxWidgets DDE client/server connections that I believe in general they appear to be very buggy. I have found both the TCP and DDE implementations to be broken - which suggests that the bug must be is some base class. I have written a TCP/IP version of my app using just regular sockets and both the Windows and Linix versions appear to work perfectly. However if I use wxWidgets DDE (either DDE or TCP/IP) I have severe issues.

When using the wxWidgets DDE version I notice the following issues:

Windows:
Random OpenGL errors

Linux
Random OpenGL errors, followed by (at some random point in time) 100% CPU usage. It should be noted this 100% CPU usage only occurs if a message is being processed while I am resizing/mousing over the window.

I originally built off of the WxWidgets IPC sample project. At first I thought it was because logging was occuring outside the GUI thread. I removed all GUI logging and still have the same behavoir.

I believe that there is memory corruption that is taking place - however finding where can be elusive.
toxicBunny wrote:I just wanted to say that I've had issues using TCP with the IPC classes on XP. I have an application that uses DDE for IPC, and everything works as expected. If I set

Code: Select all

#define wxUSE_DDE_FOR_IPC 0
the initial connection appears to be made from the client side, but it hangs using 100% of the CPU as soon as it tries to write to the socket stream. I haven't had time to debug this and only a Windows version of my application is required at the moment. However, it would be good to determine why there are issues using TCP with the IPC classes under Windows.

-Scott
knace
In need of some credit
In need of some credit
Posts: 5
Joined: Thu Nov 09, 2006 3:30 pm

same problem

Post by knace »

I have the same problem with my code. my os is windows xp. the problem only occurs when I try to use tcp implementation of dde. one thing though, if i manually start the client via a button (event call), it connects to the server fine but if i try to initialize the client automatically in a frame constructor or the application oninit call, the program hangs (cpu 100%). I'll probably end up using wxTCPServer but it would be nice if someone can verify this possible bug.
sergey.s
In need of some credit
In need of some credit
Posts: 1
Joined: Mon Nov 17, 2008 3:45 pm

Post by sergey.s »

Hello, i would like to mention that toxicBunny post from 19 aug of 2005 is still actual. As it was mentioned, the connection is initiated, but afterwards client hangs. The OS is windows xp pro with service pack 2.
Post Reply