Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3349414
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:39:42+00:00 2026-05-18T01:39:42+00:00

So I have a server and a client that communicate various data back and

  • 0

So I have a server and a client that communicate various data back and fourth. Initially I had a complicated method that went through the byte array and converted all of its variables and strings, one by one, into what they were supposed to be. I learned I could put all of the variables into an object and convert it to a byte array using

private static byte[] ObjectToByteArray2(Object obj)
    {
        if (obj == null)
            return null;
        BinaryFormatter bf = new BinaryFormatter();
        MemoryStream ms = new MemoryStream();
        bf.Serialize(ms, obj);
        return ms.ToArray();
    }

And convert it back using

private static Object ByteArrayToObject(byte[] arrBytes)
    {
        MemoryStream memStream = new MemoryStream();
        BinaryFormatter binForm = new BinaryFormatter();
        memStream.Write(arrBytes, 0, arrBytes.Length);
        memStream.Seek(0, SeekOrigin.Begin);
        Object obj = (Object)binForm.Deserialize(memStream);
        return obj;
    }

The problem is, once I send this byte array across the network to another application, I can’t just use this method to convert it back, I get the error “Unable to find assembly ‘test1s, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’.” test1s is just the name of the little server program I made to play with this. Obviously the application needs some extra information to convert this array back into an object, so is there any way I can do this, or am I going about the problem wrong?

What I want to accomplish here is have an object of nothing but several variables and strings, convert it to a byte array, send it to another application, and convert it back into the object. This way I don’t have to play with the byte array to extract all of my variables and strings.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T01:39:43+00:00Added an answer on May 18, 2026 at 1:39 am

    There are a myriad of pre-rolled serialization libraries that will help here. BinaryFormatter has some (IMO) undesirable features here – in particular it will only work with the exact same (well, pretty much) dll at both ends.

    XmlSerializer, DataContractSerializer and JavaScriptSerializer are good text-based implementations, and will work fine with a compatible contract at both ends (same properties etc – not necessarily the same type/version).

    If you have moderate bandwidth needs, or need better CPU performance I would recommend protobuf-net (caveat: I wrote it) which is a fast binary serializer that may help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .NET client application that needs to communicate with a server using
I'm developing a client/server app that will communicate via rest. Some custom request data
I have a client/server application that communicates with .Net remoting. I need my clients
i have a server - client application that runs on java 1.3; i want
I have a client server application that sends XML over TCP/IP from client to
I have a client-server application that uses .net remoting. The clients are in a
I have a client server based windows forms application that needs an administrator only
we're have a client that needs to get interactive messages from a server, from
I have a feeling that there must be client-server synchronization patterns out there. But
I have wrote a simple client that use TcpClient in dotnet to communicate. In

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.