Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using QtWebSockets - can't connect to echoserver

This question corresponds to this QtWebSockets implementation.

I am trying to include websockets server functionality in a bigger qt-based project.

I have cloned the repo above and built the library as well as the example applications (release mode). Among the examples there is an echoserver and an echoclient. After built i start the echoserver, which seems to be successful (on terminal i see: Echoserver listening on port 1234). Then i start the echoclient, which exits immediately (no printout on the console). The server console does not show any signs of detecting connection attempts. The server listens on 0.0.0.0:1234 (checked with netstat). The client tries to connect on "ws://localhost:1234/".

I modified the echoclient example to connect to echo.websocket.org and rebuilt it. After starting the client it connects successfully and the sent message is echoed back.

I created a simple html file with a websocket client trying to connect to the echoserver and opened it with a browser. This again cannot connect to the server (works with echo.websocket.org).

Environment:

  • Ubuntu 13.10(64bit) running as a virtualbox guest on a win7 machine.
  • Qt5.2(64bit)

I thought that this is something to do with the virtualbox networking settings, so i repeated the whole thing above on the host OS (win7, 64bit). I get the same results.

Br, Szabolcs

like image 429
novaczkisz Avatar asked Dec 31 '25 03:12

novaczkisz


1 Answers

This problem does not happen in Qt 5.4 anymore. According to the comments above it was a bug in Qt and it seems to be fixed now, because in my environment the echoserver and echoclient work just fine.

My Environment:

  • Ubuntu 14.04(64bit) running as a virtualbox guest on a win7 machine.
  • Qt5.4(32bit)

Therefore I propose to mark this question as answered.

like image 192
Alex Avatar answered Jan 04 '26 00:01

Alex



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!