I have to identical applications written by me operating on two different machines. I want to send either a complete instance of a form across a TCP/IP network to a peer machine, or at least the class other information necessary to recreate the form on the remote computer. I believe it can be achieved with a TCP/IP client and employing the use of unsafe memory pointers to access the memory space of the form. Surely there are simpler ways to achieve this???
Any ideas greatfully accepted.
Loading
Anwar BuchooPosted Feb 22, 2006, 2:40 AM
Items That Can Be Serialized:
The following items can be serialized using the XmlSerializer class.
(source MSDN online help)
cfquebPosted Feb 10, 2006, 3:27 PM
AnttiPosted Feb 10, 2006, 3:26 AM
How does the unmanaged pointers help when transferring data over network...? Other machine can never access directly to other machine.
Well, you could make a custom carrier class, which can carry all relevant information you need to duplicate the form behaviour at the other machine. Serializing the whole System.Windows.Form would be quite useless.
The carrier object would be serialized in local machine to xml or binary, and transferred to the remote machine, and deserialized there, and new form is initialized there according to the information of the carrier object.
This is the way I would do it:
1) create form
2) create and initialize carrier object
3) serialize carrier to either xml or binary
4) transfer carrier to other machine over the protocol you choose
5) deserialize carrier data to carrier object
6) create and initialize your new form using carrier's data
7) show your form
Transferring data to xml is simple using XmlSerializer-object. See MSDN for an example. Well, you could try to serialize the whole Form object, but it consumes lots of network resources, since it has many, many fields. But if the transfer is happening quite seldom, go ahead.