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

  • SEARCH
  • Home
  • 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 3313476
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:07:11+00:00 2026-05-17T22:07:11+00:00

I want to serialize an object and send it over the network. I have

  • 0

I want to serialize an object and send it over the network. I have set it up using ISerializeable attribute on my class and BinaryFormatter to convert the object to bytes. I can send the object and deserialize it on the receiving end. However, in order to assure that I have the entire object before trying to reconstruct it, I want to send the size along with the stream. I’d like to set the first few bytes as the size, check when the received data is at least this fixed size, then I can read that and get the full size of the object. Then, it’s simply a matter of waiting until my received data is the size of the object+ the fixed size bytes. How can I offset my data in my stream so that I can send an int to store the size of the object as the first few bytes, and my object as the remaining bytes?

  • 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-17T22:07:12+00:00Added an answer on May 17, 2026 at 10:07 pm

    The right answer is:

    SocketPacket socketData = (SocketPacket)asyn.AsyncState;
    socketData.currentSocket.EndReceive(asyn);
    byte[] data = socketData.dataBuffer;   
    

    Is not the right way to read from a SocketPacket

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

Sidebar

Related Questions

I am using Telerik controls in my webforms and want to serialize object on
I have some complex object graphs, when I want to send them down to
Hi I have TCP/IP client server application. i want to send large serialized object
I have an object that I want to send with my jquery.ajax function but
I want to set some attributes just before the object is serialized, but as
I have a collection of classes that I want to serialize out to an
in a C program I have an long* that I want to serialize (thus
I'm writing some C++ code that will have to send data over TCP/IP. I
I have an object that I'd like to serialize and distribute between processes as
I want to serialize a form into json, process the json object, then reserialize

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.