1

Topic: Connections on "localhost" and "127.0.0.1"

Hello, ripened a question I ask not to kick strongly  in QT 5.6.1, the client incorporates to the server on TCP m_pTcpSocket - a copy of type QTcpSocket m_pTcpSocket-> connectToHost ("localhost", 2323); at instructions in host name "localhost" joins without problems m_pTcpSocket-> connectToHost ("127.0.0.1", 2323); at instructions in host name "127.0.0.1" that is IP, there is no connection... Prompt please because of what and how it  that on  could ip be inscribed?

2

Re: Connections on "localhost" and "127.0.0.1"

Hello, _agg, you wrote: _> Hello, ripened a question I ask not to kick strongly  in QT 5.6.1, the client incorporates to the server on TCP _> m_pTcpSocket - a copy of type QTcpSocket _> _> m_pTcpSocket-> connectToHost ("localhost", 2323); _> _> at instructions in host name "localhost" joins without problems _> _> m_pTcpSocket-> connectToHost ("127.0.0.1", 2323); _> _> at instructions in host name "127.0.0.1" that is IP, there is no connection... Prompt please because of what and how it  that on  could ip be inscribed? telnet localhost 2323 telnet 127.0.0.1 2323 work equally? ps: not CentOS?

3

Re: Connections on "localhost" and "127.0.0.1"

Hello, all it I do on Windows 7, telnet incorporates without problems and so "telnet localhost 2323" and so "telnet localhost 2323" Hello, kov_serg, you wrote: _> telnet localhost 2323 _> telnet 127.0.0.1 2323 _> work equally? _> ps: not CentOS?

4

Re: Connections on "localhost" and "127.0.0.1"

Hello, with the help telnet and so "telnet localhost 2323" and so "telnet 127.0.0.1 2323" incorporates without problems, OS on which all it I do Windows 7 Hello, kov_serg, you wrote: _> telnet localhost 2323 _> telnet 127.0.0.1 2323 _> work equally? _> ps: not CentOS?

5

Re: Connections on "localhost" and "127.0.0.1"

Noted such singularity if connection I create here so: m_ptxtHost-> displayText () = "127.0.0.1" port=2323 m_pTcpSocket-> connectToHost (m_ptxtHost-> displayText (), port); That in the slot from a signal error (QAbstractSocket:: SocketError err) happens nothing if connections I create here so: m_pTcpSocket-> connectToHost (m_ptxtHost-> displayText (), port,QIODevice::ReadWrite,QAbstractSocket::IPv6Protocol); that in the slot with socket errors comes here such code QAbstractSocket:: HostNotFoundError Hello, _agg, you wrote: _> Hello, with the help telnet and so "telnet localhost 2323" and so "telnet 127.0.0.1 2323" incorporates without problems, OS on which all it I do Windows 7

6

Re: Connections on "localhost" and "127.0.0.1"

Hello, _agg, you wrote: _>... If connections I create here so: _> _> m_pTcpSocket-> connectToHost (m_ptxtHost-> displayText (), port,QIODevice::ReadWrite,QAbstractSocket::IPv6Protocol); _> Well as it is logical. Try for ipv6 0:0:0:0:0:0:0:1 address.

7

Re: Connections on "localhost" and "127.0.0.1"

Before to write here naturally I tried to specify IPv6Protocol, IPv4Protocol, AnyIPProtocol. IPv6 addressing works, incorporates without problems, and "localhost" for this addressing too works, does not work IPv4, on "localhost" incorporates, and "127.0.0.1" does not incorporate. Here in it a problem. Hello, SaZ, you wrote: SaZ> Well as it is logical. Try for ipv6 0:0:0:0:0:0:0:1 address.

8

Re: Connections on "localhost" and "127.0.0.1"

Hello, _agg, you wrote: _> at instructions in host name "127.0.0.1" that is IP, there is no connection... Prompt please because of what and how it  that on  could ip be inscribed? How you define, what there is no connection? The signal connected () twitches? At instructions "localhost"and"127.0.0.1" at a socket a little different behavior.

9

Re: Connections on "localhost" and "127.0.0.1"

Hello, the signal connected () does not twitch, twitches a signal error (QAbstractSocket:: SocketError) with code HostNotFoundError. SS> As you define, what there is no connection? The signal connected () twitches? SS> at instructions "localhost" and "127.0.0.1" at a socket a little different behavior.

10

Re: Connections on "localhost" and "127.0.0.1"

Hello, _agg, you wrote: _> Hello, ripened a question I ask not to kick strongly  in QT 5.6.1, the client incorporates to the server on TCP _> m_pTcpSocket - a copy of type QTcpSocket _> _> m_pTcpSocket-> connectToHost ("localhost", 2323); _> _> at instructions in host name "localhost" joins without problems _> _> m_pTcpSocket-> connectToHost ("127.0.0.1", 2323); _> _> at instructions in host name "127.0.0.1" that is IP, there is no connection... Prompt please because of what and how it  that on  could ip be inscribed? Not the expert in pluses and QT, but judging by the documentation (http://doc.qt.io/qt-4.8/qabstractsocket … ctToHost-2) is selected 1 a function overloading (with a line, instead of with the address). For  is special enum which it is possible to use as the first parameter (QHostAddress:: LocalHost), it is more  on http://doc.qt.io/qt-4.8/qhostaddress.html

11

Re: Connections on "localhost" and "127.0.0.1"

Hello, here the connection code on IPv4: QHostAddress ha; ha.setAddress (m_ptxtHost-> displayText ()); bool res (false); quint32 ipv4addr=ha.toIPv4Address (&res); if (res) {m_pTcpSocket-> connectToHost (QHostAddress (ipv4addr), port);} else {m_ptxtInfo-> append ("IPV4 Address not valid"); return;} In m_ptxtHost-> displayText () - is the address which was located there from the list: QList <QHostAddress> addresses = QHostInfo:: fromName (QHostInfo:: localHostName ()).addresses (); After that in addresses there are all possible local addresses in all types addressings for the given computer, at me on their computer 2 in this list of IPv4-type and IPv6-type when I substitute the IPv6-type address incorporates without problems, connection with the address of type IPv4 signals error (QAbstractSocket:: SocketError) with code HostNotFoundError. All is simple it strange against that that telnet localhost 2323 and telnet 127.0.0.1 2323 incorporate to a server without problems and as transit  to these addresses. I  in Qt, whether but for no reason a problem and anybody turn out at once with it faced that? Hello, Twirl, you wrote: T> Not the expert in pluses and QT, but judging by the documentation (http://doc.qt.io/qt-4.8/qabstractsocket … ctToHost-2) is selected 1 a function overloading (with a line, instead of with the address). T> For  is special enum which it is possible to use as the first parameter (QHostAddress:: LocalHost), it is more  on http://doc.qt.io/qt-4.8/qhostaddress.html

12

Re: Connections on "localhost" and "127.0.0.1"

The question is removed by all thanks, launched a program on a computer, advanced systemcare it found the big heap of any errors, pushed to correct after that became incorporate the client to a server on IPv4. A tin a pancake, magic Windows...