An21
An21

Reputation: 31

QtRO - class qremoteobjects - how can connect 2 and more remote peers beetwen TCP

I was build example simpleswitch with registry node in Qt5.9. It's work fine, but when i replace QUrl("local.registry") and QUrl("local.replica") in definition QRemoteObjectRegistryHost and QRemoteObjectHost to QUrl("tcp://localhost:9999") or "tcp://127.0.0.1:9999", or paste current host address to defniton... i have error after run app...

qt.remoteobjects: Listen failed for URL: QUrl("tcp://127.0.0.1:9999")

qt.remoteobjects: QAbstractSocket::AddressInUseError

qt.remoteobjects: Could not create ClientIoDevice for client. Invalid url/scheme provided? QUrl("")

Upvotes: 3

Views: 917

Answers (2)

jomamaxx
jomamaxx

Reputation: 121

If Qt is indicating that 'the address is in use' then that is likely the source of the problem, literally the socket at IP:PORT is being used. You may check your development environment to see if you have multiple processes running of the same app - this is often the case and it leads to a collision of address spaces. We see this error in our environment consistently, and the root cause is simply as stated: 'the address is in use'.

Upvotes: 0

Alexander Gin
Alexander Gin

Reputation: 21

The valid value, use instead of QUrl("local.registry"):

QUrl("tcp://192.168.0.3:-1");

The valid value, use instead of QUrl("local.replica"):

QUrl("tcp://192.168.0.3:9999");

The IP address 192.168.0.3 - used for example (it value valid for my workstation in our office network) in your case IP address can contain other digits.

Upvotes: 2

Related Questions