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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:15:41+00:00 2026-06-16T19:15:41+00:00

I have written code which reads network stream and stores data into byte array,

  • 0

I have written code which reads network stream and stores data into byte array, then convert that byte array to string array.

I want to remove non printable ASCII character (Code 28 i.e. File Separator) from string array or directly from byte array.

How can I achieve the same ?

I tried following code:

saBytesReceived = saBytesReceived.Select(s => s.Replace(@"[^U+001C]", "")).ToArray();

Code :-

if (serverSocket.Connected)
{
   bBytesToRead = serverSocket.Available;

   if (bBytesToRead > 0)
   {
      try
      {
         bDataReceived = new byte[bBytesToRead];
         networkStream.Read(bDataReceived, 0, bBytesToRead);
         try
         {
            if (System.Text.ASCIIEncoding.ASCII.GetString(bDataReceived).Trim() != "")
            {
               uncompletedMessage.IdleCount = 0;                                            
               saBytesReceived = System.Text.ASCIIEncoding.ASCII.GetString(bDataReceived).Split(new string[] { "\n" }, StringSplitOptions.None);
               saBytesReceived = saBytesReceived.Select(s => s.Replace(@"[^U+001C]", "")).ToArray();
            }
         }
      }
   }
}
  • 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-06-16T19:15:42+00:00Added an answer on June 16, 2026 at 7:15 pm

    Not sure about the byte array but from the string you can use string.Replace. If its a single string:

    string str = "1" + (char)(28) + "2";
    //str.Length == 3
    str = str.Replace(((char)28).ToString(), "");
    //str.Length == 2
    

    For array:

    saBytesReceived = saBytesReceived.Select(s => s.Replace(((char)28).ToString(), "")).ToArray();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a code which sniffs packets on the network. It then filters
I have pasted a code snip below that I have written which reads a
I have a file download script that I have written, which reads files from
I have written to code to read and write to registry which is working
I have written PHP code which connects to MYSQL to look up information, sends
I have written a code which does the thing as the title says. The
I have written a code in which i want to open a HTM file
Need assistance with the pexpect module I have written a simple code which would
I have written two pieces of code which I intended to have identical outputs,
I have written some code in JSP to download .docx files which is hosted

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.