views:

338

answers:

4

Well, i have a C# forms application, and im looking for the best way to transfer a string of data from the application, to another computer, on a different network, to be opened by a different C# application. anyone know the best way to do this?

+6  A: 

I would use WCF - Windows Communication Foundation

Shiraz Bhaiji
A: 

If you are using .Net 3.0+ use WCF otherways use msmq

Yassir
Can anyone provide code examples of how to do this?
Tommy
+2  A: 

OR if you are using <= .Net 2.0, and you can(no firewall issues etc) just use standand TCP/IP. You open a Listening socket on the destination machine, and then on your sending machine you just Connect to it, send your data and disconnect.

Obviously if you are going to be doing more activities, you will need to manage disconnection problems, invalid data, loss of network etc, but for basic send something, receive it, TCP

Paul Farry
A: 

A good solution for a form app is the xmlserializer. It's built into all versions of .net. You can send it as a file over the network and then deserialize it with the other form app. There's one snag that you will run into, which is the app that serializes the file puts an identifier in the file that the deserializing app will not have that will cause the deserializer to fail, but there are a couple of easy work arounds that you will find.

gino