Results 1 to 20 of 22

Thread: QTcpSocket only works local

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2010
    Posts
    26
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTcpSocket only works local

    Quote Originally Posted by fatjuicymole View Post
    Start->Run type "cmd" and press enter.
    After the window opens, type "ipconfig"
    There is some number after "Ethernet adapter LAN: IP Address". Paste it.

    I do NOT want your external IP address, just the IP address of your PC.
    If you don't want to paste the whole address, just paste the first number before the first '.', so 1.2.3.4 would be '1'
    Qt Code:
    1. C:\Users\Alberto>ipconfig/all
    2.  
    3. Windows IP Configuration
    4.  
    5. Host Name . . . . . . . . . . . . : Alberto-PC
    6. Primary Dns Suffix . . . . . . . :
    7. Node Type . . . . . . . . . . . . : Hybrid
    8. IP Routing Enabled. . . . . . . . : No
    9. WINS Proxy Enabled. . . . . . . . : No
    10.  
    11. Ethernet adapter Local Area Connection:
    12.  
    13. Connection-specific DNS Suffix . :
    14. Description . . . . . . . . . . . : VIA Rhine II Compatible Fast Ethernet Ada
    15. pter
    16. Physical Address. . . . . . . . . : 00-21-97-70-2F-B2
    17. DHCP Enabled. . . . . . . . . . . : No
    18. Autoconfiguration Enabled . . . . : Yes
    19. Link-local IPv6 Address . . . . . : fe80::a8a0:aa3d:1ee5:341e%11(Preferred)
    20. IPv4 Address. . . . . . . . . . . : 192.168.1.4(Preferred)
    21. Subnet Mask . . . . . . . . . . . : 255.255.255.0
    22. Default Gateway . . . . . . . . . : 192.168.1.1
    23. DHCPv6 IAID . . . . . . . . . . . : 234889623
    24. DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-13-A4-BF-BC-00-21-97-70-2F-B2
    25.  
    26. DNS Servers . . . . . . . . . . . : 200.175.182.139
    27. 200.175.5.139
    28. NetBIOS over Tcpip. . . . . . . . : Enabled
    29.  
    30. Tunnel adapter isatap.{4B5533D6-8370-4E1B-8B37-B9A758FF504B}:
    31.  
    32. Media State . . . . . . . . . . . : Media disconnected
    33. Connection-specific DNS Suffix . :
    34. Description . . . . . . . . . . . : Microsoft ISATAP Adapter
    35. Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
    36. DHCP Enabled. . . . . . . . . . . : No
    37. Autoconfiguration Enabled . . . . : Yes
    38.  
    39. Tunnel adapter Teredo Tunneling Pseudo-Interface:
    40.  
    41. Connection-specific DNS Suffix . :
    42. Description . . . . . . . . . . . : Teredo Tunneling Pseudo-Interface
    43. Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
    44. DHCP Enabled. . . . . . . . . . . : No
    45. Autoconfiguration Enabled . . . . : Yes
    46. IPv6 Address. . . . . . . . . . . : 2001:0:4137:9e74:1458:d42e:448d:7cad(Pref
    47. erred)
    48. Link-local IPv6 Address . . . . . : fe80::1458:d42e:448d:7cad%13(Preferred)
    49. Default Gateway . . . . . . . . . : ::
    50. NetBIOS over Tcpip. . . . . . . . : Disabled
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTcpSocket only works local

    Right, so do you have the ports used by fortune server forwarded by your router? If not, you are not going to be able to do anything but local traffic.

  3. #3
    Join Date
    Aug 2010
    Posts
    26
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTcpSocket only works local

    Quote Originally Posted by fatjuicymole View Post
    Right, so do you have the ports used by fortune server forwarded by your router? If not, you are not going to be able to do anything but local traffic.
    hmmmmm, i feeling we're getting close, i'm actually using an once unnused port, 2112, first, how do I know the fowarded ports of my router, and second, how do i foward one?
    And if everthings works fine, looks like HTTP, FTP, P2P, SSH and Messengers ports are all fowarded?
    thanks in advance fatjuicymole
    Last edited by BrainStorm; 8th August 2010 at 23:31. Reason: updated contents

  4. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTcpSocket only works local

    HTTP/FTP/SSH are outbound only. They don't need to be forwarded. Your PC requests the connection. P2P can detect your PC is unreachable and since you connect to lots of other people, rather than people connecting to you, it can inform your PC via a proxy to connect to them. Same with Messenger, which connects to a central hub to relay messages.

    I don't know your router, and so I've no idea how it works. Did you buy it or did it come free from your ISP? The former should be easy to edit the configuration. The later is normally more difficult as ISPs like to lock these things down to stop people from messing with it.

    Either way, you may want to lookup the UPnP architecture. Maybe your router has it enabled. If it is, your P2P/Messenger client is most likely already using it to forward ports to itself.

  5. #5
    Join Date
    Aug 2010
    Posts
    26
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTcpSocket only works local

    Quote Originally Posted by fatjuicymole View Post
    HTTP/FTP/SSH are outbound only. They don't need to be forwarded. Your PC requests the connection. P2P can detect your PC is unreachable and since you connect to lots of other people, rather than people connecting to you, it can inform your PC via a proxy to connect to them. Same with Messenger, which connects to a central hub to relay messages.

    I don't know your router, and so I've no idea how it works. Did you buy it or did it come free from your ISP? The former should be easy to edit the configuration. The later is normally more difficult as ISPs like to lock these things down to stop people from messing with it.

    Either way, you may want to lookup the UPnP architecture. Maybe your router has it enabled. If it is, your P2P/Messenger client is most likely already using it to forward ports to itself.
    My modem is a SmartAX MT880a, my ISP provided it but i have full access to it, but, i'm not going to mess with it so, i have to learn how to (in code) use upnp to forward ports and make my apps works fine, can you point me a start? thanks anyway, you're being a light.

    update:
    I was looking aroung my modem configuration and, upnp is not active, but firewall is. I've gone further, I've runned remote nmap agains me and the results looks weird, like i'm not even up (no ping). I'm afraid of turning off my modem's firewall, what a sad problem
    Last edited by BrainStorm; 8th August 2010 at 23:31.

  6. #6
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTcpSocket only works local

    Yes, your modem has your external IP address, so no one even knows your PC exists as the modem will typically block all pings. This is a great advantage - any attacks get aimed at your modem rather than your PC so far less risk of your PC being hacked, as people can't see it.

    No need to turn off the firewall, just enable the upnp and leave it as that. Make sure you use Windows update as the original version of UPNP on Windows had some vulnerabilities.

    How to use UPNP in Qt is really beyond the scope of this forum, but there is a lot of information out there and a good number of open source apps which have UPNP included.

  7. #7
    Join Date
    May 2011
    Posts
    3
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTcpSocket only works local

    sorry for bumping this thread, but I have same problem, my application need to create server where other can connect, but it do it local.. when i give to my friend, he has different internet provider and he can create server

    i read this thread, but didn't found the answer what should i do (probably u said it, but i'm not god with network configuration, and couldn't understand..)

    i have huawei 520 echolife router, and have all admin priviliges, so what should i enable/disable

  8. #8
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTcpSocket only works local

    That depends on what you have setup, you may need to punch a hole in the firewall and you may need to add a route to your NAT configuration.

    We can't tell you exactly what to do because we don't know your exact network configuration.

Similar Threads

  1. Local Status Bar Does Not Update
    By shawno in forum Qt Programming
    Replies: 0
    Last Post: 16th July 2010, 01:34
  2. item local coordinate
    By dreamer in forum Qt Programming
    Replies: 6
    Last Post: 11th May 2008, 22:49
  3. How to get and set local ip in windows xp using QT?
    By longtrue in forum Qt Programming
    Replies: 0
    Last Post: 5th May 2008, 08:55
  4. Replies: 1
    Last Post: 24th September 2007, 09:02
  5. How to get local IP
    By naresh in forum Qt Programming
    Replies: 11
    Last Post: 17th May 2006, 15:48

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.