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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:04:54+00:00 2026-06-01T00:04:54+00:00

I am getting a stream of byte data from a telnet session via TcpClient.GetStream().ReadByte()

  • 0

I am getting a stream of byte data from a telnet session via TcpClient.GetStream().ReadByte(). I am then converting this byte data to ASCII via char casting. The data comes through fine, but with a lot of extra junk like 1[01;001H[0k[01.

Anyone have any idea what this extra junk might be?

UPDATE
More detailed response stream below

1[01;001H[0K[01;017H[0;1;4mTitle of Page Here[0;1m[0;1m[02;001H[02;051H[0KWed Mar 28, 2012 03:03 pm[02;051HDate Time Here[0J[03;001H[0J[23;001H[0J[0;1;7mPrompt Here[P]– [0;1m[23;044H

When it should read

Title of Page Here
Date Time Here

Prompt Here

  • 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-01T00:04:55+00:00Added an answer on June 1, 2026 at 12:04 am

    Parts of the ‘junk’ you’re seeing are part of the Telnet protocol. The remote is trying to negotiate some options with you, and may also send you some other commands (although that’s relatively rare in practice). See the TELNET COMMAND STRUCTURE section of the applicable RFC for the exact format and meaning of all possible commands.

    In most cases, you’ll be able to simply ignore any Telnet commands (including option negotiation) received, but you do have to filter them: as you discovered, simply treating a Telnet session as a clean TCP stream won’t work.

    In addition to protocol-level options, the remote may also assume you’re a terminal, and send escape sequences to ensure the data is properly displayed. Interpreting or filtering those codes will depend on the type of terminal the remote is configured to use — it’s not unlikely you’ll encounter a VT100, for example.

    There’s no real need to delve too deeply into the specs, by the way: it’s entirely feasible to use something pre-built like this minimalistic Telnet library to deal with the most important details for you.

    EDIT, 29 March 2012: The additional examples of the ‘junk’ you’re seeing confirm that the remote is treating you as a VT100. For example: [0;1;4mTitle of Page Here corresponds to Set Attribute Mode: <ESC>[{attr1};...;{attrn}m and tries to make the page title appear bright (1) and underlined (4).

    Simplest option here: as soon as you see an ESCape character (ASCII 27), ignore everything after that up to and including the first character that isn’t in the list [;0123456789. That will strip the most common VT100 codes: there are a few that may require special handling, but those are rare, and anyway, you have the specs now.

    But even if you strip the control codes, you may still end up with an unparseable data stream, especially if the host tries to maintain a fancy screen layout. For example, it may randomly update a status field (e.g. a clock) in the middle of a stream of values that you’re interested in. If that’s the case, you’ll need a (virtual) VT100 emulator annex screen scraper. Those kinds of solutions mostly seem to involve expensive commercial software, although libvt100 – A purely .net/C# library for parsing a VT100/ANSI stream may work for you.

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

Sidebar

Related Questions

I am getting raw aac data from web stream and try to put it
I am reading data from a TCP/IP stream and am successfully receiving a byte
I'm getting a stream from HttpWebResponse.GetResponseStream() where I'm reading data from. Now I want
I'm trying to serialize some data for a UDP packet stream and I'm getting
I am writing at NTRIP client on WM6. Basically I am getting data from
I'm having trouble getting a memory stream and a XML text writer class to
Getting the subdomain from a URL sounds easy at first. http://www.domain.example Scan for the
Getting this error: 2009-09-03 12:44:02.307 xcodebuild[307:10b] warning: compiler 'com.apple.compilers.llvm.clang.1_0.analyzer' is based on missing compiler
Getting a rendering error for this form: 'NoneType' object has no attribute 'widget' http://dpaste.com/88585/
Getting a 'marshal data too short' error when trying to install the mysql gem

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.