c# - Named Pipes passing Object, End of Stream issues -


i trying pass class object via named pipes in c#. error "end of stream encountered before parsing completed" . frustrating since, i've managed send strings without problems. can see issue?

client side sending data:

      using(namedpipeclientstream cs =        new namedpipeclientstream("myserver", "mypipename", pipedirection.out, pipeoptions.asynchronous))           observablecollection<myobject> messagetosend = new observablecollection<myobject>(new myobject() { myprop1 = "hello", myprop2 = 7 });           iformatter f = new binaryformatter();           foreach (var item in messagetosend)           {              f.serialize(pipestream, item);           } 

server side receiving data:

  namedpipeserverstream ss = new namedpipeserverstream("mypipename", pipedirection.in);   ss.waitforconnection();   iformatter f = new binaryformatter();   myobject messagereceived = (myobject)f.deserialize(cs); 

also, when add receiver i've got error "stream not support seeking".

ss.position =0; 

the class used message type:

 [serializable]   public class myobject   {     public string myprop1     {       get;       set;     }     public int myprop2     {       get;       set;     } 


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -