[Interest] QTcpSocket bind method failed when proxy server is configured in windows OS

neel patel neel5481 at gmail.com
Tue Jul 4 07:30:54 CEST 2017


Yes. It is HTTP proxy. Thank you Thiago for the information.

Thanks

On Mon, Jul 3, 2017 at 10:04 PM, Thiago Macieira <thiago.macieira at intel.com>
wrote:

> On segunda-feira, 3 de julho de 2017 03:14:32 PDT neel patel wrote:
> > Hi,
> >
> > I am just finding the free available random port using below code in
> > windows OS. ( Using Qt 5.9.1 ).
> >
> >
> > *quint16 port = 0L;*
> > *QTcpSocket socket;        *
> > *socket.bind(0, QTcpSocket::ShareAddress);*
> > *port = socket.localPort();*
> >
> > Windows OS - When the proxy server is not configured then above code
> works
> > fine but when user configure the proxy server in windows then "bind"
> method
> > fails and gives "Operation not permitted" error.
> >
> > Can anyone suggest how to solve this issue when proxy server is
> configured ?
>
> What kind of proxy server is it? If it's an HTTP proxy, then the behaviour
> is
> expected, since HTTP proxy servers do not permit binding.
>
> If you need the socket bound locally regardless of proxy,
>         socket.setProxy(QNetworkProxy::NoProxy);
>
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
>   Software Architect - Intel Open Source Technology Center
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170704/eeeb6052/attachment.html>


More information about the Interest mailing list