QTcpSocket and QUdpSocket on Windows 10, blocked?
-
@jsulm , I was just looking at:
https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers#Well-known_portsWhats preventing me choosing a port that is in use for something else? For example 13?
@SPlatten said in QTcpSocket and QUdpSocket on Windows 10, blocked?:
Whats preventing me choosing a port that is in use for something else? For example 13?
As already written by @jsulm , port numbers bellow 1000 are reserved for system. You need to have root rights to bind on them.
This is called security ;) -
@jsulm , I was just looking at:
https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers#Well-known_portsWhats preventing me choosing a port that is in use for something else? For example 13?
@SPlatten said in QTcpSocket and QUdpSocket on Windows 10, blocked?:
Whats preventing me choosing a port that is in use for something else?
From the link you posted (and what I wrote before): "On Unix-like operating systems, a process must execute with superuser privileges to be able to bind a network socket to an IP address using one of the well-known ports."
-
@KroMignon , @jsulm , ok, I've changed the port to 30119 for UDP communications, which seems to work on one application, on the other application that is going to receive the broadcasts and act on them I'm getting:
Failed to bind UDP socket: The bound address is already in useBoth applications are running on the same laptop, how do I set-up the receiver so it can receive messages broadcast on the same IP and port 30119 ?
-
@KroMignon , @jsulm , ok, I've changed the port to 30119 for UDP communications, which seems to work on one application, on the other application that is going to receive the broadcasts and act on them I'm getting:
Failed to bind UDP socket: The bound address is already in useBoth applications are running on the same laptop, how do I set-up the receiver so it can receive messages broadcast on the same IP and port 30119 ?
@SPlatten said in QTcpSocket and QUdpSocket on Windows 10, blocked?:
Both applications are running on the same laptop, how do I set-up the receiver so it can receive messages broadcast on the same IP and port 30119 ?
Do you want to bind each socket on same port?
So you have allow reusing same port:if(!pUDPsocket->bind(QHostAddress::LocalHost, 8124, QAbstractSocket::ShareAddress | QAbstractSocket::ReuseAddressHint)) { qWarn() << "Failed to bind UDP socket:" << pUDPsocket->errorString(); } -
@SPlatten said in QTcpSocket and QUdpSocket on Windows 10, blocked?:
Both applications are running on the same laptop, how do I set-up the receiver so it can receive messages broadcast on the same IP and port 30119 ?
Do you want to bind each socket on same port?
So you have allow reusing same port:if(!pUDPsocket->bind(QHostAddress::LocalHost, 8124, QAbstractSocket::ShareAddress | QAbstractSocket::ReuseAddressHint)) { qWarn() << "Failed to bind UDP socket:" << pUDPsocket->errorString(); }@KroMignon , thank you, I literally just added exactly that, compiling now and will try.
-
@SPlatten said in QTcpSocket and QUdpSocket on Windows 10, blocked?:
Both applications are running on the same laptop, how do I set-up the receiver so it can receive messages broadcast on the same IP and port 30119 ?
Do you want to bind each socket on same port?
So you have allow reusing same port:if(!pUDPsocket->bind(QHostAddress::LocalHost, 8124, QAbstractSocket::ShareAddress | QAbstractSocket::ReuseAddressHint)) { qWarn() << "Failed to bind UDP socket:" << pUDPsocket->errorString(); }@KroMignon , its working :)
-
@KroMignon , yes, presently both the sender and receiving applications are running on the same laptop.
The problem I'm having is the laptop is so locked down by the company IT that I'm not sure if it is causing problems, as I said, last week these same applications were communicating.
I will try capturing data on WireShark for the UDP port.
I've just added filter to WireShark:
udp.port eq 81248124 is the port I'm using to broadcast on, I've also modified my source to:
writeDatagram(bytaryDoc, QHostAddress::Broadcast, suint16Port);Seeing nothing in WireShark.
@SPlatten said in QTcpSocket and QUdpSocket on Windows 10, blocked?:
The problem I'm having is the laptop is so locked down by the company IT that I'm not sure if it is causing problems, as I said, last week these same applications were communicating.
And therein is the problem...and it ticks me off to no end. If you cannot own and control your dev resources then you're just whizzin in the wind when you need to do real work. These dumb-acre kids who think they know and understand network security need to be taken to the wood shed and whipped with a willow switch when they start treating devs like office admin workers.
-
@SPlatten said in QTcpSocket and QUdpSocket on Windows 10, blocked?:
The problem I'm having is the laptop is so locked down by the company IT that I'm not sure if it is causing problems, as I said, last week these same applications were communicating.
And therein is the problem...and it ticks me off to no end. If you cannot own and control your dev resources then you're just whizzin in the wind when you need to do real work. These dumb-acre kids who think they know and understand network security need to be taken to the wood shed and whipped with a willow switch when they start treating devs like office admin workers.
@Kent-Dorfman , this is a large corporate company dealing with the ministry of defence they take security and IT very seriously...it does make life very difficult, but they have deep pockets so the cost doesn't hurt them so much.
-
You can check the Windows 10 firewall settings to make sure that your applications are allowed through. Just search for ""firewall"" in the Start menu and click on ""Windows Defender Firewall"". From there, you can click on ""Allow an app or feature through Windows Defender Firewall"" and make sure that your applications are checked.