Sending objects/data across network?

Does compact framework have serialization I wish to send object accross the network.

Anyone have any ideas Using desktop .net i would serialize a struct and send it via a socket.

What are people using in compact framework Thanks.



Answer this question

Sending objects/data across network?

  • PiyuGupta

    gafferuk wrote:

    Does compact framework have serialization I wish to send object accross the network.

    Anyone have any ideas Using desktop .net i would serialize a struct and send it via a socket.

    What are people using in compact framework Thanks.

    I think what you mean by serialization is "remoting" or "web services". serialization is a broad topic, a technique used in many ways, in many places, including remoting. remoting allows serialization across app domains, or over the network, web services, over the web, through xml serialization. you can use web services to wrap a remoting service and expose it to a compact framework application.


  • Mike L Hayes

    MSDN has an example on how to use XML serializer, please go ahead and look it up if you need one.

    No, I'm not going to modify code for you; it’s up to you to do it. Please see this, item 15 on why is that:

    http://www.danielmoth.com/Blog/2005/03/please-read-before-posting-to-ng.html

    Also keep in mind managed code on NETCF is not real time due to unpredictable GC behavior. If you need real time, you probably should use C++.



  • keopsito

    Have you given a try to Serialization I'm not sure I haven't used it in Compact Framework. But i think it should be there.

    If you have simple data in class or struct like, int. float double etc Use BitConvertor class to make you own Serialization and Deserialization alpgorithm.

    For other Data types there are many classes to convert that type to byte array. Those will help.

    Need an Example of what I'm saying Feel Free to write again!

    Best Regards,



  • Francesco Tattoli

    Please do not cross post. Merging...



  • centexbi

    i tried using System.Runtime.Serialization.Formatters.Binary; but it says does not exist.

    I f you have an example that would be great.


  • pixelord

    AndrewBadera wrote:
    gafferuk wrote:

    Does compact framework have serialization I wish to send object accross the network.

    Anyone have any ideas Using desktop .net i would serialize a struct and send it via a socket.

    What are people using in compact framework Thanks.

    I think what you mean by serialization is "remoting" or "web services". serialization is a broad topic, a technique used in many ways, in many places, including remoting. remoting allows serialization across app domains, or over the network, web services, over the web, through xml serialization. you can use web services to wrap a remoting service and expose it to a compact framework application.

    I can't use webServices because i need to send data both ways in real time as it's an input device for MIDI.

    I have decided to go with sending simple strings over socket as i think serialising data is a bit of an overhead.

    The strings will simply be someting like: 0:60:127, nice and small to quickly be sent over netork.

    Thanks for your advice.


  • PedroCGD

    I have not ever used xmlSerialization do you have an example

     

    The code i use is:

     

    [Serializable]

    public struct ChatKey

    {

    public String request;

    }

     

    // transmit side:

    BinaryFormatter sendBinaryFormatter;

    sendBinaryFormatter = new BinaryFormatter();

    MemoryStream memoryStream = new MemoryStream();

    ChatKey chatKey = new ChatKey();

    chatKey.request = "lalala";

    sendBinaryFormatter.Serialize(memoryStream, chatKey);

    byte[] sendBuff = memoryStream.ToArray();

    handler.Send(sendBuff, sendBuff.Length, 0);

     

     

     

    // receive side:

    NetworkStream myNetworkStream;

    myNetworkStream = new NetworkStream(handler);

    BinaryFormatter receiveBinaryFormatter;

    receiveBinaryFormatter = new BinaryFormatter();

    ChatKey chatKey = (ChatKey)receiveBinaryFormatter.Deserialize(myNetworkStream);

     

     

    If you could modify this for xml that would be great! It's for a software MIDI controler im building here

    I need to send and receive data as fast as possible as it's a real-time input device.


  • xtw

    NETCF supports XML serialization. Or you can implement your own serialization for particular class - just save and restore all relevant fields the way you want.



  • Shailesh Nikam

    Does compact framework have serialization I wish to send object accross the network.

    Anyone have any ideas Using desktop .net i would serialize a struct and send it via a socket.

    What are people using in compact framework Thanks.


  • Sending objects/data across network?