How to allow *all* incoming TCP connections

Page 1 of 3 123 LastLast

  1. Posts : 28
    Windows 7 Ultimate x86
       #1

    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 Computer


  2. Posts : 10,485
    W7 Pro SP1 64bit
       #2

    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 Computer


  3. Posts : 28
    Windows 7 Ultimate x86
    Thread Starter
       #3

    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 Computer


  4. Posts : 2,468
    Windows 7 Ultimate x64
       #4

    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 Computer


  5. Posts : 10,485
    W7 Pro SP1 64bit
       #5

    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 Computer


  6. Posts : 28
    Windows 7 Ultimate x86
    Thread Starter
       #6

    UsernameIssues said:
    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 Computer


  7. Posts : 10,485
    W7 Pro SP1 64bit
       #7

    Maybe this website can guide you:
    Free Help Forwarding Ports - PortForward.com
      My Computer


  8. Posts : 28
    Windows 7 Ultimate x86
    Thread Starter
       #8

    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 Computer


  9. Posts : 10,485
    W7 Pro SP1 64bit
       #9

    Use your home computer to run the scan mentioned above.
      My Computer


  10. Posts : 28
    Windows 7 Ultimate x86
    Thread Starter
       #10

    UsernameIssues said:
    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 Computer


 
Page 1 of 3 123 LastLast

  Related Discussions
Our Sites
Site Links
About 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 23:00.
Find Us