

odriscog
Forum Replies Created
-
odriscog
MemberMarch 11, 2024 at 5:53 pm in reply to: 'fd out of range' error during one-shot query -
odriscog
MemberMarch 11, 2024 at 5:38 pm in reply to: 'fd out of range' error during one-shot queryFormatting of the code snippet got messed up and won’t allow me to edit. See below:
/ Server (running on negative port)
.cfg.handle:
:host:port:user:pass;</p><p>method:{[] .cfg.handle"til 5";};</p><pre><p><br></p><p>/ Client</p><p>h:
hopen:server_host:server_port;h"method[]"; / throws 'fd out of range' error
-
Thank you very much for the help, Peter. The issue was indeed that I wasn’t including the Authorization header with the connection.
Initially, I was trying to create my QWebSocket by providing the credentials in the URL like this
QWebSocket m_websocket = new QWebSocket(); m_websocket.open(QUrl(QStringLiteral(“ws://user:pass@host:port”)));
I didn’t realise there is an option to use the open method with a QNetworkRequest which would allow me to add headers to the request. So I changed it to the below and it worked:
QWebSocket m_websocket = new QWebSocket(); QNetworkRequest req(“ws://host:port”); req.setRawHeader(“Authorization”, “Basic <base64 encoded user:pass>”); m_webSocket.open(req);
Thank you very much again for your help.