Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Serializing Objects for socket transport

Status
Not open for further replies.

MrCSharp

IS-IT--Management
Jun 7, 2005
59
CA
I am trying to write a decent client/server application. I am stuck on sending my objects back and forth. I have been reading all day and cant seem to find the answer i need.

I have come up with the following class, when I serialize the data its fine, i send it to the client fine, when I try to deserialize it on the client side it throws an error, cand find the server assembly.Why would it be looking for the server assembly? Any help/recomendations would be more than welcomed.


[Serializable()]
public class ChatterList : ArrayList
{
public Chatter Find(string id)
{
foreach (Chatter c in this)
{
if (c.ID == id)

return c;
}
return null;
}

public static byte[] SerializeList(ChatterList clist)
{
MemoryStream ms = new MemoryStream();
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(ms, clist);
return ms.ToArray();
}
public static object DeSerializeList(byte[] data)
{
MemoryStream ms = new MemoryStream(data);
BinaryFormatter bf = new BinaryFormatter();

return (ChatterList)bf.Deserialize(ms);
}
}
 
I figured it out, I was just using the same code file instead of making a class library and using that. So even though they were the same they were different. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top