Results 1 to 4 of 4

Thread: TCP server-client application with external access

  1. #1
    Join Date
    Jan 2011
    Posts
    10
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question TCP server-client application with external access

    Hi,

    maybe this is a network question, rather than specific to Qt, but I need to know.
    I want to make a TCP server-client connection between two Qt app (one is server, listening, and the other is client, connecting to the IP-port of the server). However, this connection should not only be within a LAN, but also outside of LAN.

    For example, from the client, I want to connect to the server with the external IP of the server (not the local IP 192.168. etc, but the real IP) and the port that I choose. If I set my router for port-forwarding, would this be possible? Or in some other way?

    Did any one make such directly connection?
    Thanks for your help and suggestions.

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: TCP server-client application with external access

    Your computer has a local address inside your local network. For it to be accessible outside this network, you need a router. Forward an incomming port on your router to the desired address and port in your local network.

    As always: make sure you are secure.

  3. #3
    Join Date
    Jan 2011
    Posts
    10
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: TCP server-client application with external access

    Before doing external connection, I even could not make the connection btw Fortune Server - Fortune Client examples. I am running Fortune Server, and then in the same computer Fortune Client, and trying to connect to the IP-port told by Fortune Server, but can not connect*. I have tried to run Fortune Client in another computer in LAN, but the same. I do not know what I am missing.

    *When I edit Fortune Server Example code and set IP as localhost (127.0.0.1), yes it is connected within the same computer. However, if I don't edit the code, and let Fortune Server Example find another IP, it finds an IP that I do not recognize, and it can not be connected. I do not know what IP it is finding. I looked ipconfig /all, there is not such IP in anywhere.
    Last edited by dominate; 4th February 2011 at 13:03.

  4. #4
    Join Date
    Jan 2011
    Posts
    10
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: TCP server-client application with external access

    I have tried to connect using external IP from another computer in LAN, but it couldn't. I thought maybe it was because both computers were in the same LAN and so to check it I have installed an application to my Iphone. I have closed the connection of the mobile to carrier, so it was just connected to my LAN. And, SURPRISE!!! From the application in my Iphone, using external IP, I could connect to Qt4 Fortune Server Example and got response!!! So, the problem is not trying to connect using external IP from within the same LAN; because Iphone could connect with another application. So, anyone has idea, why Qt4 Fortune Client Example CAN NOT connect to Fortune Server Example using external IP ?

Similar Threads

  1. Load Testing Tool for client server application
    By live_07 in forum Qt Programming
    Replies: 2
    Last Post: 4th November 2009, 18:19
  2. Multi Threaded Client Server application
    By live_07 in forum Qt Programming
    Replies: 0
    Last Post: 27th August 2009, 16:32
  3. TCP Client-Server Application
    By Tavit in forum Qt Programming
    Replies: 1
    Last Post: 18th March 2008, 13:20
  4. Client-Server Application design suggestion
    By berzeck in forum Qt Programming
    Replies: 6
    Last Post: 17th December 2007, 18:13

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.