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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:45:30+00:00 2026-05-22T12:45:30+00:00

I have a simple program I’m developing to perform some bandwidth tests on remote

  • 0

I have a simple program I’m developing to perform some bandwidth tests on remote computers my company controls at our client sites. One copy of the program goes on a remote computer and is told to listen on a specified port. Another copy of the same program is then told to connect to the listening computer, then send a serialized object with a message of known length, random contents. The transfer is timed and the results sent back to the originating machine.

It works fine over the loopback interface; two copies of the program going, one listening on a part, the other connecting to that same port (in a shared manner) and sending the data. However, when I move the “remote” side of this test to a different test machine on the same intranet, even though the program says it’s “listening” for its connection, the port cannot be connected to by the program on my dev machine. I get the standard error “No connection could be made because the target machine actively refused it”.

There are no active firewalls between these two computers, including Windows Firewall. I can create other types of remote connections such as VNC.

Here are the relevant code snippets:

Listening for a connection:

    public void BeginListeningAsServer()
    {
        if (Listener != null) Listener.Stop();
        if (ListenerThread != null) ListenerThread.Join();
        Listener = new TcpListener(RemoteAddress, RemotePort);
        Listener.Start();
        Listening = true;
        ListenerThread = new Thread(ListenForConnections);
        ListenerThread.Start();
    }

    private void ListenForConnections()
    {
        while (Listening)
        {
            if (Listener.Pending())
                Listener.BeginAcceptTcpClient(HandleIncomingClient, null);
        }
    }

    private void HandleIncomingClient(IAsyncResult ar)
    {
        var client = Listener.EndAcceptTcpClient(ar);
        var thread = new Thread(c => HandleIncomingClientMessage((TcpClient)c));
        HandlerThreads.Add(thread);
        Clients.Add(client);
        thread.Start(client);
    }

Connecting to this listening program:

    public void ConnectAsClient()
    {
        var client = new TcpClient();
        client.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
        client.Connect(RemoteAddress, RemotePort); //this line fails
        Clients.Add(client);
    }
  • 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-22T12:45:31+00:00Added an answer on May 22, 2026 at 12:45 pm

    The way you star your listener is a bit off. You don’t need to specify the Address, only the port.

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

Sidebar

Related Questions

I have a simple Tray icon program that opens a site using System.Diagnostics.Process.Start(URL) And
I have two simple while loops in my program that I feel ought to
I have a simple script which is used to start another program. This other
Have a look at this very simple example WPF program: <Window x:Class=WpfApplication1.Window1 xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
I have the need to express simple conditionals as program input. The input must
I have a relatively simple select statement in a VB6 program that I have
Say I have simple program that emulates a board game with a number of
I have simple chat program using WCF service. One service use for server and
I have a simple program that uses TcpClient and SslStream to write data to
I have a simple program which loops through a resultset when a button is

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.