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 7006913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:32:19+00:00 2026-05-27T21:32:19+00:00

I have a function that takes an array as a parameter. The function then

  • 0

I have a function that takes an array as a parameter. The function then fills the array up with information of unknown length. So how would I create an array to store a message of unknown length? Because I can’t specify the size of the array since I don’t know the size of the message it is going to store.

Would this be valid?

byte [] array;
function (array);

And then the size of the array will be determined by the size of the message it is filled in?
If this isn’t possible how would I do this?

I need the array to be the exact size of the message it is filled up with, so I can’t just specify the array to be some random size big enough to fit the message.


Additional, from a comment:

public int ReceiveFrom( byte[] buffer, int offset, int size, 
       SocketFlags socketFlags, ref EndPoint remoteEP ) 
  • 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-27T21:32:20+00:00Added an answer on May 27, 2026 at 9:32 pm

    About using

    public int ReceiveFrom( byte[] buffer, int offset, int size, 
       SocketFlags socketFlags, ref EndPoint remoteEP ) 
    

    You are supposed to use this in a loop. You are receiving parts of the total message (stream) at a time. Up to you to decide which part you need. Optionally shift the rest down and specify an offset in the next call.

    byte[] buffer = new byte[1024];
    ínt n;
    do 
    {
        n = ReceiveFrom(buffer, 0, buffer.Lenght, ...);
    
        if (n > 0)
            // process n bytes in buffer
    
    } while (n > 0);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function that takes 2 D character array as parameter class listview{
I have this Array i wrote a function MostFreq that takes an array of
I have a function that takes, amongst others, a parameter declared as int privateCount
I have a function that takes a struct, and I'm trying to store its
I want to create a function that takes an integer as it's parameter and
I have a function that takes a parameter(key) to retrieve it's value from a
I have C function that takes string pointer as a parameter. This functions returns
I have a JavaScript function that takes two required parameters and then arbitrarily many
I have a function that takes a parameter and produces a result. Unfortunately, it
I have a C function that takes a parameter of type LPVOID. The values

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.