Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: How to allow *all* incoming TCP connections


13 Apr 2014   #1

Windows 7 Ultimate x86
 
 
How to allow *all* incoming TCP connections

Hello there,

I am making a Remote Control program like Teamviewer in VB.Net using the TCP protocol and it works fine locally (in LAN), but nobody outside of my network can connect to my computer. I've tried to add exceptions to all TCP ports and I've tried to totally disable the firewall, but there still is no connection. Why is this+how do you fix it?

-Rixterz


My System SpecsSystem Spec
.

13 Apr 2014   #2

W7 Pro SP1 64bit
 
 

How are users attempting to connect?

How does your app handle NATs?

How does your app handle brute forcing the credentials needed to connect/control?
My System SpecsSystem Spec
13 Apr 2014   #3

Windows 7 Ultimate x86
 
 
Reply to UsernameIssues

This link may help you understand the process:
HttpListener Class (System.Net)

Users simply connect by navigating to 127.0.0.1:8080/HttpListener/ on a web browser.

Here is my code:

Code:
Imports System.Net
Imports System.Globalization
Public Class Form1
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Dim prefixes() As String = {"http://*:8080/HttpListener/"}
        ProcessRequests(prefixes)
    End Sub
    Private Sub ProcessRequests(ByVal prefixes() As String)
        If Not System.Net.HttpListener.IsSupported Then
            MsgBox("Windows XP SP2, Server 2003, or higher is required to " & "use the HttpListener class.")
            Exit Sub
        End If
        If prefixes Is Nothing OrElse prefixes.Length = 0 Then
            Throw New ArgumentException("prefixes")
        End If
        Dim listener As System.Net.HttpListener = New System.Net.HttpListener()
        For Each s As String In prefixes
            listener.Prefixes.Add(s)
        Next
        Try
            listener.Start()
            MsgBox("Listening...")
            Dim numRequestsToBeHandled As Integer = 10
            For i As Integer = 0 To numRequestsToBeHandled
                Dim response As HttpListenerResponse = Nothing
                Try
                    Dim context As HttpListenerContext = listener.GetContext()
                    response = context.Response
                    Dim responseString As String = "<HTML><BODY>Yay! Response received!</BODY></HTML>"
                    Dim buffer() As Byte = System.Text.Encoding.UTF8.GetBytes(responseString)
                    response.ContentLength64 = buffer.Length
                    Dim output As System.IO.Stream = response.OutputStream
                    output.Write(buffer, 0, buffer.Length)
                Catch ex As HttpListenerException
                    MsgBox(ex.Message)
                Finally
                    If response IsNot Nothing Then
                        response.Close()
                    End If
                End Try
            Next
        Catch ex As HttpListenerException
            MsgBox(ex.Message)
        Finally
            listener.Close()
            MsgBox("Done Listening...")
        End Try
    End Sub
End Class
I ran this code on my computer and also opened Google Chrome. I navigated to 127.0.0.1:8080/HttpListener/ and I received the response. But when I use my public IP and connect to 86.xxx.xxx.xxx:8080/HttpListener/, I get this error on Chrome:
"Google Chrome could not load the web page because 86.xxx.xxx.xxx took too long to respond".

Please download and run the application from this link, and click OK on the messagebox saying "Listening...". Then go on a web browser and navigate to 127.0.0.1:8080/HttpListener/. You'll see a little message. And then go to whatismyip.com and navigate to TheDisplayedIP:8080/HttpListener/.
My System SpecsSystem Spec
.


13 Apr 2014   #4

Windows 7 Ultimate x64
 
 

It's very likely that your router is dropping the connection, because of NAT. Your program is probably OK, as it does work locally, but you'll need to do a port forwarding on your router to let your computer actually receive the connection. As it stands in your samples, 8080 is the port you need to open.

BTW, you might want to use a non-standard port instead of 8080, as it's a frequently used to attack random server found with open ports (like you want to). At least until your program is stable enough to withstand heavy, malicious load, it's better to use a random port instead.

Also, as it seems, your program don't work like TeamViewer at all. TeamViewer uses a central server to which all clients connect, and it acts as a man in the middle that establishes the connections, so all users only need outgoing access. Yours does a direct connection, much like the built-in Terminal Serveer, in a "peer-to-peer" fashion.
My System SpecsSystem Spec
13 Apr 2014   #5

W7 Pro SP1 64bit
 
 

Thanks for the additional info.

As mentioned, you will need port forwarding. Whatever port number that you opt to forward, you might want to scan it via this tool.
My System SpecsSystem Spec
14 Apr 2014   #6

Windows 7 Ultimate x86
 
 

Quote   Quote: Originally Posted by UsernameIssues View Post
Thanks for the additional info.

As mentioned, you will need port forwarding. Whatever port number that you opt to forward, you might want to scan it via this tool.
But I have no clue how to portforward!
My System SpecsSystem Spec
14 Apr 2014   #7

W7 Pro SP1 64bit
 
 

Maybe this website can guide you:
Free Help Forwarding Ports - PortForward.com
My System SpecsSystem Spec
14 Apr 2014   #8

Windows 7 Ultimate x86
 
 

Ugh, it doesn't even work. I configured everything and forwarded it to this computer, using both tcp and udp ports as 1000-1010. I navigated to loopback:1005/SecretPassword/ and it worked, but using my public ip 86.xxx.xxx.xxx:1005/SecretPassword/ still gave nothing. Useless.
My System SpecsSystem Spec
14 Apr 2014   #9

W7 Pro SP1 64bit
 
 

Use your home computer to run the scan mentioned above.
My System SpecsSystem Spec
14 Apr 2014   #10

Windows 7 Ultimate x86
 
 

Quote   Quote: Originally Posted by UsernameIssues View Post
Use your home computer to run the scan mentioned above.
I ran the scan on port 1005 and it said

THE EQUIPMENT AT THE TARGET IP ADDRESS
DID NOT RESPOND TO OUR UPnP PROBES!

So it's just telling me what I already know without telling me how to deal with it
My System SpecsSystem Spec
Reply

 How to allow *all* incoming TCP connections




Thread Tools



Similar help and support threads for2: How to allow *all* incoming TCP connections
Thread Forum
VPN not accepting incoming connections. Network & Sharing
What's the max number of incoming connections (aka VPN) Windows 7 supp Network & Sharing
Incoming Connections Troubleshoot Shortcut - Create Tutorials

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 11:05 PM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33