Process communication in widgets Topic is solved

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
kps
Knows some wx things
Knows some wx things
Posts: 31
Joined: Tue Jan 03, 2012 4:55 am

Process communication in widgets

Post by kps »

Hi all,

May be this is nothing to do with wxWidgets, But sure this forum will give some inputs.

I am develping an wxWidgets application with trace functionality. I have three process.

One process for managing GUI, It gets the data from the other two processes and displayes it in the textcontrol (wxRichText) . Other two processes are clients to the main process. I have used sockets for sending the data to the main process from the clients.

The data from clients are not in order and the events ( SOCKET_INPUT) in the sockets is delayed. Usually the data rate in clients are 2 - 50 socket message in 0.9 micro-seconds.

Is there any better approach to send the data to main process to solve the orderliness of the traces from the clients.

I was thinking of the following solutions:

1. UDP sockets (wxDatagramSocket) , main process blocks on the server sockets. But this has huge data loss.
2. List ( wxList ) in the shared memory. Can the list be used in global shared memory so that the data is written by the clients with some semaphore protection?

Kindly provide some inputs in wxWidgets

kps
User avatar
doublemax
Moderator
Moderator
Posts: 19159
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Process communication in widgets

Post by doublemax »

Using shared memory would be fastest. but there is no support for that in wxWidgets. You could try boost instead: http://www.boost.org/doc/libs/1_49_0/do ... ocess.html

In wxWidgets you could try to use wxServer, wxConnection, wxClient instead of lowlevel socket stuff.
http://docs.wxwidgets.org/stable/wx_ipcoverview.html
This should make the coding a little bit easier and in Windows it would use DDE instead of TCP/IP by default which should theoretically be faster, i never tested that though.
Use the source, Luke!
kps
Knows some wx things
Knows some wx things
Posts: 31
Joined: Tue Jan 03, 2012 4:55 am

Re: Process communication in widgets

Post by kps »

Thanks for the reply.

As you said the data reception is very fast compared to sockets. But server not able to receive from both the clients.

Connection is successful two clients and then data is sent for a while and suddenly blocks in Poke in one of the clients.

If send data is sent from only one client using poke, It works really good.

Is it possible to have multiple clients in DDE?

kps
kps
Knows some wx things
Knows some wx things
Posts: 31
Joined: Tue Jan 03, 2012 4:55 am

Re: Process communication in widgets

Post by kps »

kps wrote: Is it possible to have multiple clients in DDE?

kps
I found some threads related for the above question (http://forums.wxwidgets.org/viewtopic.p ... ent#p19506 )

Amazing forum !!!

Can we create a blocking wxClient connection like we have wxSOCKET_BLOCK for Tcp sockets ?

Regards
kps
User avatar
doublemax
Moderator
Moderator
Posts: 19159
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Process communication in widgets

Post by doublemax »

When you compile the "ipc" sample that comes with wxWidgets, you can start one server and multiple clients and it seems to work.
Use the source, Luke!
Post Reply