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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:12:22+00:00 2026-05-26T11:12:22+00:00

I am trying to write a basic app that will read data off a

  • 0

I am trying to write a basic app that will read data off a port. Here is my code:

static void Main(string[] args)
{
    int port = 5600;
    string server = "MyDevLaptopName";
    TcpClient tcpClient = new TcpClient();
    tcpClient.Connect(server, port);

    NetworkStream stream = tcpClient.GetStream();
    byte[] data = new byte[256];
    stream.Read(data, 0, data.Length);

    Console.ReadLine();
}

When I run the app above I get this error on the tcpClient.Connect command:

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 10.90.91.19:5600

I am not sure why my computer will not respond (I am totally new to TCP ports and such).

Is there a different way I need set this up to read data from a TCP port?

Things I have checked:

  • Windows Firewall is completely off.
  • The IP address listed in the error is the internal IP address of my development machine (the machine I am trying to connect to).
  • I do have Symantec Endpoint Protection, but it is controlled by Group Policy and it would be difficult for me to get turned off (but I can do it if need be).

Update:
There is a main frame server that is supposed to be sending TCP data to that port. I do not control that machine/server or the method that it sends the data. I am just trying to read the data that is sent to the port.

Update II:
The main frame is actually sending the data to a VM at my company. I then use the technique found here to redirect that TCP traffic to the same port on my machine (where I hoped I could just read it off).

Update III:
The mainframe is the client and I need to be the server!. Once I realized that I got things working.

  • 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-26T11:12:23+00:00Added an answer on May 26, 2026 at 11:12 am

    I would try with another port number, are you in control of the server as well? if so try to follow these steps:

    C# Tutorial – Simple Threaded TCP Server

    as you will see there you can listen in this way:

    namespace TCPServerTutorial
    {
      class Server
      {
        private TcpListener tcpListener;
        private Thread listenThread;
    
        public Server()
        {
          this.tcpListener = new TcpListener(IPAddress.Any, 3000);
          this.listenThread = new Thread(new ThreadStart(ListenForClients));
          this.listenThread.Start();
        }
      }
    }
    

    and you can connect in this way:

    TcpClient client = new TcpClient();
    
    IPEndPoint serverEndPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 3000);
    
    client.Connect(serverEndPoint);
    
    NetworkStream clientStream = client.GetStream();
    
    ASCIIEncoding encoder = new ASCIIEncoding();
    byte[] buffer = encoder.GetBytes("Hello Server!");
    
    clientStream.Write(buffer, 0 , buffer.Length);
    clientStream.Flush();
    

    it seems trivial and it is, but port number is not a detail as some ports are not available or blocked by firewalls or so…

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

Sidebar

Related Questions

im trying to write an app that will display a list off lines from
I'm trying to write a Sinatra app that will run on a shared Passenger
I'm trying to write a very simple terminal app that will scan for Bluetooth
Im trying to write a very basic android app that displays around 5 pictures
Trying to write a PowerShell cmdlet that will mute the sound at start, unless
Trying to write a couple of functions that will encrypt or decrypt a file
I'm trying to write a regex function that will identify and replace a single
I'm trying to write a basic augmented reality app in Android, but I'm running
I have a c# app and I'm trying to write a basic login form
I'm trying to write an API for a website, whose Flash app gets data

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.