How do I telnet to a specific port on a Windows 8 Consumer Preview machine?

15,718

Assuming that the commands you listed are returning valid data and 192.168.100.93 is the IP address of your machine (you could use 127.0.0.1 instead), your client won't be able to connect, as there isn't anything listening on the port.

Is your listening application using TcpClient to listen on a port? If not then the problem is on your listening application, so please show that code instead.

Share:
15,718
Mike
Author by

Mike

Updated on June 12, 2022

Comments

  • Mike
    Mike almost 2 years

    I have been trying to troubleshoot a program that 'listens' on port 7751 for TCP connections. In Windows 7 and before, sometimes I have to enable the port in any firewall software that exists but otherwise it works OK.

    In testing on Windows 8 Consumer Preview, my app is unable to start its 'listening' service, and I get the error: "No connection could be made because the target machine actively refused it".

    I turned off the Windows Firewall totally, to eliminate it, but the problem still exists (no other security software is installed on this Win8 box).

    In order to eliminate my program, I went through the "Turn on/off Windows features" applet in Control Panel, and installed Telnet Server and Client. I have started the Telnet service (and made it automatic), and also added "Everybody" and myself specifically into the TelnetClients local group.

    When I run from the command line:

    telnet 192.168.100.93 7751

    I am told "Could not open connection to the host, on port 7751".

    I tried the following:

    netstat -an | find /i "listening"

    But the port 7751 was not listed (and program that should listen on it was running).

    This port is not blocked by the firewall, as it is turned off.

    I tried telnet to another port that was listed by the netstat command, and it works OK.

    My application connects to the port using the following:

    System.Net.Sockets.TcpClient tcpc = new TcpClient();
    tcpc.Connect(server, port);
    

    But the .Connect immediately sends it to the

    catch(SocketException s)
    

    Which reports the "No connection could be made because the target server actively refused it." Note the "target server" is itself.

    My App is a regular Windows Forms app, in C#, which is built by Visual Studio 2005 (.net 2.0) on the Windows 8 box itself...

    What am I doing wrong?

    EDIT: In answer to the question below, the code which starts the listening is:

    private TcpListener tcpL;    
    IPEndPoint ipEndPoint = new IPEndPoint(ipAddress, Configuration.portNumber);    
    tcpL = new TcpListener(ipEndPoint);    
    tcpL.Start();
    

    (ipAddress and Configuration.portNumber are my IP address 192.168.100.93, and 7751 respectively).

    This code is within a try/catch and does not go to the catch, so I assume it started OK?