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

The Archive Base Latest Questions

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

IS this straightforward? Does any one have any good examples? All my google searches

  • 0

IS this straightforward? Does any one have any good examples? All my google searches return items on how to make telnet clients in dotNet but this overkill for me. I’m trying to do this in C#.

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-11T22:22:02+00:00Added an answer on May 11, 2026 at 10:22 pm

    C# 2.0 and Telnet – Not As Painful As It Sounds
    http://geekswithblogs.net/bigpapa/archive/2007/10/08/C-2.0-and-Telnet—Not-As-Painful-As-It.aspx

    Or this alternative link.

    If you’re going to use the System.Net.Sockets class, here’s what you do:

    • Create an IPEndpoint, which points to the specified server and port.
      You can query DNS.GetHostEntry to change a computer name to an
      IPHostEntry object.
    • Create a socket object with the following
      parameters: AddressFamily.InterNetwork (IP version 4),
      SocketType.Stream (rides on InterNetwork and Tcp parameters),
      ProtocolType.Tcp (reliable, two-way connection)
    • Open the socket like
      this: socket.Connect(endpoint); //yup, it’s that simple Send your
      data using socket.Send(… wait, I forgot something. You have to
      encode the data first so it can fly across them wires.
    • Use
      Encoding.ASCII.GetBytes to convert the nice message you have for the
      server into bytes. Then use socket.Send to send those bytes on their
      way.
    • Listen for a response (one byte at a time, or into a byte array)
      using socket.Receive Don’t forget to clean up by calling
      socket.Close()

    You can [also] use a System.Net.Sockets.TcpClient object instead of a
    socket object, which already has the socket parameters configured to
    use ProtocolType.Tcp. So let’s walk through that option:

    1. Create a new TcpClient object, which takes a server name and a port (no IPEndPoint necessary, nice).
    2. Pull a NetworkStream out of the TcpClient by calling GetStream()
    3. Convert your message into bytes using Encoding.ASCII.GetBytes(string)
      Now you can send and receive data using the stream.Write and stream.Read methods, respectively. The stream.Read method returns the number of bytes written to your receiving array, by the way.
    4. Put the data back into human-readable format using Encoding.ASCII.GetString(byte array).
    5. Clean up your mess before the network admins get mad by calling stream.Close() and client.Close().
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have no idea why this is happening. I have some very straightforward code,
I have this naive regex "<([\s]|[^<])+?>" (excluding the quotation marks). It seems so straightforward
OK, this begins to drive me crazy. I have an asp.net webapp. Pretty straightforward,
This should be straight forward for a guru. I don't have any code really
It seems like this should be straightforward but I'm boggling. I've got my listview
Shouldn't this be a pretty straightforward operation? However, I see there's neither a size()
I don't expect a straightforward silver bullet answer to this, but what are the
I'll try to make this as straight forward as possible. Currently our team has
I'm relatively new to the Python world, but this seems very straight forward. Google
I hope this is something straightforward that I'm doing wrong. I saw something online

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.