How to set IP to client socket



  • I'm having problem to set the socket's ip.


    client= new QTcpSocket (this);

    client->connectToHost ("10.0.0.3", 0);


    That's what I had do. The thinks here it's that 10.0.0.3 is a ip which there is in a local connection. What's I'm doing wrong?

    Thanks!



  • It is really difficult to understand what the problem is that you are describing because you really haven't described a problem. You also haven't explained what you are trying to do. Are you trying unsuccessfully to connect to a computer with that address? Are you trying (unsuccessfully) to connect a computer at that address to the internet? Any IP address that starts with 10 is a local IP address. (10.x.y.z = local address). There is absolutely no way to change that because it is a standard (I believe it was started with Novel).



  • Yes, the connection is unsuccessful. There is a code which I can follow?

    The question was If I can pass on an Ip on that way.


  • Lifetime Qt Champion

    Hi,

    Did you connect the error signal ? If not, do it, it should give you a useful hit about why it's not working.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.