By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,424 Members | 1,351 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,424 IT Pros & Developers. It's quick & easy.

Send data from 1 program to another (on same PC)

P: n/a
What's the best way?

I could use sockets, but that's overkill. I could use pinvoke'd
SendMessage() like Win32, but I assume there's a C# wrapper for this.
What might it be? The receiving program still needs to respond to a
user message, and how would C# allow this? I've seen some people use
events to send data, but how it works isn't entirely clear to me.

Any thoughts would be appreciated......
Zytan
Jun 27 '08 #1
Share this Question
Share on Google+
6 Replies


P: n/a
I've seen some people use
events to send data, but how it works isn't entirely clear to me.
Er, I think they were using events to send data between forms of the
SAME program, not between two DIFFERENT programs. So, ignore that
thought.

Zytan
Jun 27 '08 #2

P: n/a
What's the best way?

Btw, all I want to do is send a string of text.

http://www.codeproject.com/KB/vb/Sen...y_message.aspx
This guy provides a way to do it using PostMessage() and events, but
it just seems ugly to build up a string from a bunch of PostMessage()
calls..... I think I'd rather use sockets, although that raises
security issues that PostMessage() does not, and it seems like
overkill.

Zytan
Jun 27 '08 #3

P: n/a
http://www.codeproject.com/KB/vb/Sen...y_message.aspx
This guy provides a way to do it using PostMessage() and events, but
it just seems ugly to build up a string from a bunch of PostMessage()
calls.....
This method is flawed. If you have more than one thread sending it,
you get synch errors. This could be fixed, but it makes it much more
complex.

Zytan
Jun 27 '08 #4

P: n/a
http://www.codeproject.com/KB/vb/Sen...y_message.aspx
This guy provides a way to do it using PostMessage() and events, but
it just seems ugly to build up a string from a bunch of PostMessage()
calls.....

This method is flawed. If you have more than one thread sending it,
you get synch errors. This could be fixed, but it makes it much more
complex.
Actually, you just need to look at the window handle in
System.Windows.Forms.Message to distinguish between windows sending
the messages. Since you can't (shouldn't) have multiple threads
running under at the same time using a GUI, anyway, you can (should)
never have the same window sending two messages at once.

Still seems ugly to me, though.

Zytan
Jun 27 '08 #5

P: n/a
What's the best way?
If both ends are managed and under your control then use Remoting.

Cheers
Doug Forster

Jun 27 '08 #6

P: n/a
Yes
"Zytan" <zy**********@gmail.comwrote in message
news:58**********************************@f36g2000 hsa.googlegroups.com...
>If both ends are managed and under your control then use Remoting.

Doug, remoting sounds very powerful and much more easy than sockets...

Can it be used for networking one PC to another PC? Can I have the
same server<-->client communication between two programs using
remoting, both managed & under my control, but just on two PCs instead
of on the same PC?

Zytan
Jun 29 '08 #7

This discussion thread is closed

Replies have been disabled for this discussion.