hi,
i have tried XMLserializer in window application, i m using code below
to
test on window application befroe porting to
PDA,here is sample code of server
TcpClient client = null;
TcpListener tcpl = new TcpListener(3500);
tcpl.Start();
client = tcpl.AcceptTcpClient();
NetworkStream str = client.GetStream();
try {
TestClass obj = new TestClass();
obj.Name = "Tasleem";
obj.FName = "Arif";
XmlSerializer serial = new
XmlSerializer(typeof(TestClass));
serial.Serialize(str,obj);
str.Flush();
MessageBox.Show("Data Written n wait for Read");
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
tcpl.Stop();
//here is client side code
TcpClient tcpc = new TcpClient();
tcpc.Connect("127.0.0.1", 3500);
NetworkStream str = tcpc.GetStream();
try {
TestClass obj=null;
XmlSerializer serial = new
XmlSerializer(typeof(TestClass));
MessageBox.Show("Read Data");
if (str.DataAvailable)
{
obj = (TestClass)serial.Deserialize(str);
MessageBox.Show(obj.Name);
}
else
MessageBox.Show("No Data Available");
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
i m using simple class to test the serialization,
[Serializable()]
public class TestClass
{
private string _Name;
private string _Fname;
public string FName
{ get { return _Fname; } set { _Fname =
e; } }
public string Name
{ get { return _Name; } set { _Name = value; } }
}
server side function send successfully and client side function waits
and
then it hangs there not able
to desrialize tell me what i m missing?
:
Huh? If you use the XML serializer, they sure *are* stored in XML
files.
Paul T.
objects are not stored in XML files,these are binary objects.
:
Yes, I've used it and it works fine.
Paul T.
Hi,
I've been looking into this. I documentation implies the
XmlSerializer
works. I have not tried it yet. I should know soon.
Regards,
Bob
--
Regards,
Bob Binns
http://www.binnsware.com
:
hi all i want to transfer class object between 2 PDA using
library
(inthehand.dll) 32.net,
in windows application BinaryFormatter class is there for
serialization
of
object. i tried but that class is not supported in .net CF.
My question is, any replacement of that class or any method
through
which
i
can achive serilization, or that cannot be done in .net CF
My class object contains inforation about the drawing.
i want to serialize object and then transfer b/w PDA using
bluetooth.
Thanks.