Click here to Skip to main content
15,912,457 members
Please Sign up or sign in to vote.
1.80/5 (2 votes)
See more:
Hi i have 2 program and when i click the button in program A it will open program B and now i want to send something from program A to program B how can i do it?

additional information copied from comment below [Nelek]
i want to send some info from program A to program B and with this program B can't work without program A (means you just can open it from program A) and i don't want program B open without click the button in program A
Posted
Updated 8-Nov-14 11:56am
v2
Comments
Maciej Los 8-Nov-14 16:29pm    
What you mean by "send data between two programs"?
You should be more specific and provide more details about your requirements!
Avenger1 8-Nov-14 16:51pm    
i want to send some info from program A to program B and with this program B can't work without program A (means you just can open it from program A) and i don't want program B open without click the button in program A
[no name] 8-Nov-14 18:53pm    
Also keen on to get an answer on this. Especally the answer also is true for e.g. A is Service and B. is app.

My 5 for your question, even my 5 are very small compared to other downvotes :(

You can use :
1) a file
2) a socket
3) a named pipe
4) a TCP packet
 
Share this answer
 
Comments
[no name] 8-Nov-14 18:02pm    
In case one of the process is a Service and other a "simple" app, what do you suggest is the best of the 4 you listed?
Thanks and 5, Bruno
Sergey Alexandrovich Kryukov 8-Nov-14 21:58pm    
My answer: it depends. In most cases, not #1.
—SA
[no name] 9-Nov-14 9:13am    
Hello Sergey, thank you for your assessment.

It depends…depends on what?
Of course, first I like to have the speediest connection with the lowest resource consumption. And second I don’t want that user needs to concern about selection of something like a Port Number which is needed for socket, tcp.
Pipes (and maybe mailslots): I did not check it until now, but do pipes really work over session boundaries? I had to make the (for me very surprising) experience, that e.g. mutex fail over sessions.
I’m still looking for an easy and session independent IPC. I personally prefer tcp, but how can I handle port selection without the need that user has to do this?

And all this with outdated bcb6 :(

Help on this is very much appreciated.
Thanks. Bruno
Mehdi Gholam 9-Nov-14 10:14am    
Communications are all about messages so mutexes are out of the question.

Now to send messages you need to agree about the format and endpoints before hand (the contract) so ports are a given.

Personally I prefer TCP to unwieldy things like WCF (and named pipes require computer authentication before connecting), take a look at my article here for simple plugin communication : http://www.codeproject.com/Articles/156765/WCF-Killer
[no name] 9-Nov-14 11:53am    
Thank you very much for this.
May I pierce you with some questions about his?
Bruno
 
Share this answer
 
Comments
[no name] 8-Nov-14 18:05pm    
No Google does not help really. This Q Comes again and again and I feel nobody has really a concrete answer...especally if the processes are a mix of Service and normal apps.

Of course e.g. tcp can be a solution....but for simple IPC I don't like to bother customer to choose a port....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900