Click here to Skip to main content
15,883,818 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I need to transfer some string from one EXE to another.
I came across Google and found that Remoting is the best function for .Net FrameWork 2.0

My Problem :
If I select an account in EXE 1 corresponding Id should be passed from EXE1 to EXE2.
I tried different different methods but I am unsuccessful.

I tried writing a text file to pass and listening using
C#
while(true)
{
}


I received the string in EXE2 from file reading. But I want to do with the help of remoting.


How to create server and client in existing Windows Form on Corresponding EXEs
Posted
Comments
Vinay Mistry 21-Aug-14 3:29am    
You can try to pass arguments to exe2 when calling it.
KUMAR619 21-Aug-14 3:41am    
No sir Both EXE's are running SO I need to use IPC methods

1 solution

This is quite simple thing, but needs good time to explain. You can use TCP. No, the spin wait (the loop you show) is never ever needed. Everything is done according to push technology: one application is listening for new connection using a blocking call, in a wait state which does not wast any CPU time at all. It's important to listen in one thread, communication in another one.

Client side is simpler: you connect. The call is also blocking, also sleeping wasting no CPU time. When connection is established, you start communicating. You need to define some application-layer protocol on top of TCP. Please see:
http://en.wikipedia.org/wiki/Application_layer[^].

See my past answers:
an amateur question in socket programming[^],
Multple clients from same port Number[^].

—SA
 
Share this answer
 
Comments
KUMAR619 21-Aug-14 6:08am    
Sir I tried this in my Existing Project but it shows "tcp already registered".
But I searched in my entire Project but could not find it. How to make this work or any other way to pass values sir
Sergey Alexandrovich Kryukov 21-Aug-14 9:25am    
It means that you tried something different, and wrong. :-)
In what line?
—SA
KUMAR619 21-Aug-14 6:29am    
I just want to pass a string less that 3O characters.
I need to receive at the second EXE as soon as EXE 1 passes the string. I tried all the lnown methods but I couldn't do. Please help Sir
Sergey Alexandrovich Kryukov 21-Aug-14 9:26am    
How can I know what have you tried?
—SA
KUMAR619 21-Aug-14 9:32am    
I tried using Remoting using Channel But got a exception that tcp has already been registered.

So I wanna use Remoting Concept ohter than tcp.

Please share some ohter methods in Remoting.
Then I want to use two way communication i.e.

Server and Client can interact with each other.
Is there any way Sir.

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