Process communication in widgets  [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.

Process communication in widgets

Postby kps » Tue May 08, 2012 11:18 am

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

Re: Process communication in widgets

Postby doublemax » Tue May 08, 2012 12:04 pm

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!
User avatar
doublemax
Part Of The Furniture
Part Of The Furniture
 
Posts: 7151
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Process communication in widgets

Postby kps » Tue May 08, 2012 3:32 pm

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

Postby kps » Wed May 09, 2012 6:52 am

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

kps


I found some threads related for the above question (viewtopic.php?f=1&t=4356&p=19506&hilit=wxClient#p19506 )

Amazing forum !!!

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

Regards
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  [SOLVED]

Postby doublemax » Wed May 09, 2012 7:49 am

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!
User avatar
doublemax
Part Of The Furniture
Part Of The Furniture
 
Posts: 7151
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2


Return to C++ Development

Who is online

Users browsing this forum: No registered users and 9 guests