Page 1 of 1

Process communication in widgets

Posted: Tue May 08, 2012 11:18 am
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

Re: Process communication in widgets

Posted: Tue May 08, 2012 12:04 pm
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.

Re: Process communication in widgets

Posted: Tue May 08, 2012 3:32 pm
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

Re: Process communication in widgets

Posted: Wed May 09, 2012 6:52 am
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

Re: Process communication in widgets

Posted: Wed May 09, 2012 7:49 am
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.