QT - qtwebsocket - can't connect - qt

I'm using qtwebsocket from https://github.com/antlafarge/QtWebsocket on QT Creator 5.0, Linux 64bit. I'm trying connect to echo test:
wsSocket->connectToHost( "echo.websocket.org", 80 );
But I immediately get disconnected status. I tried also with ws:// and http:// prefix but same error. Any idea? I even don't know how to report a bug on this gitorious.
It is important to me to don't use webkit, I need pure TCP socket connection.
Regards

There is also a Qt websockets add-on module located at https://qt.gitorious.org/qt/qtwebsockets.
It has been tested on several platforms, and successfully succeeds with the AutoBahn Testsuite.

Just quickly looking at the example located:
https://github.com/antlafarge/QtWebsocket/tree/master/Example
I don't know the state of the project too well, but it looks like there is still a to-do list on what it can do; one item I noticed, it says WSS is not yet supported.
Try running both sides of the Client and Server in the included example, and see if you can get a connection in that context before trying the echo.websocket.org server.
Hope that helps.

Related

Every time I use expo client, my http network fails to work

TCP connections work fine as I am able to converse with someone over zoom and teamviewer. However, whenever I attempt to access another webpage, I get a network error. Google seems to work fine for some reason but any webpage I go to listed by Google fails to connect. The only way I can open up my http connections is by ending a task called "init" inside of task manager. This shuts down my vscode as well as my ubuntu terminals I have running. If someone knows the solution please do tell. It's really annoying having to close out my vscode and terminals as well as my local servers to look up information and debug.
I found a fix to this issue.
So I was running a Windows Subsystem for Linux and my Windows Build was outdated as well as WSL. When I updated Windows and upgraded to WSL2, my issue was resolved and I don't seem to get any more network errors.

Qt application running with `-platform offscreen` argument cannot establish websocket connection

I have a GUI application which contains a websocket server QWebSocketServer. I also have a python script which sends messages and the application processes them. Everything works well. During testing I wanted to run the application in headless mode using -platform offscreen command line argument added to the app executable name (I changed nothing else). But the problem is that when the application runs off-screen, the client script cannot establish connection with the web socket server. I tested this on localhost only. I do not understand how this two things, visibility of GUI and websockets, can interfere. Any ideas what could go wrong?
Note: I am using Qt 5.11.1 64-bit with VS 2017 on Windows 10 Pro.
A platform plugin is a bit more than merely "GUI". The -platform option selects a family of platform-specific plugins. Perhaps some plugins that make networking work are absent on that platform spec. That's very likely, since the offscreen platform is only a proof-of-concept: it's to show how you'd write a platform plugin. It's example code, and it does the bare minimum needed. It's nothing that you should be using for production without fully understanding what's there and how it works - it wasn't not meant for it, at least not the last time I looked at it. It shouldn't be hard to make it work, but you'd need to clone the source and start hacking on it.

Hosting asp.net on mono xsp - raspberry pi

I'm trying to run the sample application that comes with xsp package on my Raspberry Pi (running arch linux), but unfortunately apparently the connection is closed before any http response is sent to the browser. I get on chrome the "NO DATA RECEIVED" message.
xsp however just outputs "Application_Start" and nothing else happens (other than chrome saying no data received)
Here's what I do:
$ xsp2
xsp2
Listening on address: 0.0.0.0
Root directory: /srv/http/test
Listening on port: 8080 (non-secure)
Hit Return to stop the server.
Application_Start
And Chrome's output:
No data received
Unable to load the webpage because the server sent no data.
Here are some suggestions:
Reload this webpage later.
Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.
Of course on my Linux PC box it runs fine.
If anyone got any insights other than I'm trying to take too much out of my $35 board, let me know?
For the information of whoever visits this page:
Raspberry pi does not have an official mono implementation on hard float operations. That's why a lot of mono stuff will NOT work, including xsp =]
A gentleman posted on raspberry pi forums an experimental version of mono with an implementation of hard-float which form me worked fine. The post is here.
For Arch Linux users, I've come up with a package build so that you can create an arch linux package, and posted on the same thread. Exactly here. Instructions on how to build it are also there.
Running xsp will work after this, at least for me it did. I also did use .NET to handle GPIO and all worked beautifully.
Hopefully this helps! =]
With a bit of reflection and a socket server it's not that hard to create your own asp.net host (well I got it to support <% %> syntax with code behind and user controls (don't use/want the built in controls since they are less portable and not as transparent as I'd like)). Works fine on my arch berry.
Or you could try the self hosting from MS http://www.asp.net/web-api/overview/hosting-aspnet-web-api/self-host-a-web-api, not sure if it works with mono though (but do let us know if it does ;)).
If you are using the Raspbian distribution the Mono packages are having issues compiling and the ones that are out there have issues running .Net applications because of the specific processor features Raspbian takes advantage of. You have to use the older Debian that does not use the Hard Float armhf.
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=66&t=11634&start=75

Flash SWF On Solaris Won't Load When Also Loading Apache APR Library in JBoss

UPDATE + SOLUTION ===============================
Sorry to be posting the solution here instead of in a comment, but something about my work's filtering doesn't allow the comment functionality to work for me.
I ended up using the -b 0.0.0.0 property in jboss to bind to all addresses, so I could try accessing machine A's server with machine B as the client, and vice-versa. I found that it always failed to load when running on machine B, whether or not I was connecting from A or B.
I started wireshark on a windows machine on the same network, and observed the TCP connection that was loading the webpage. I saw that the request for the .swf in the cases where it failed had a content length of 2 million or so, and when I right clicked the wireshark logs and selected "view conversation" or something like that, the size of the total conversation to get the .swf file was only 130,000. Looking at about:cache, that was about equal to what it ended up caching before saying "Done" on the page.
I ended up finding that there is a bug with the useSendFile property. (http://community.jboss.org/thread/148651?tstart=0). This causes it to only send part of the file if you are running low on kernel memory. Using useSendFile="false" in our server.xml has seemed to resolve the problem.
==================================================
Original Problem
I have a JBoss (5.1.0.GA) application server. I am using GraniteDS to connect between the application server and the client. The client side is flash-based.
Granite DS requires the use of the APR library (apache native library), so I am loading it. I see in the JBoss logs that it says it loaded the apache native library just fine (version 1.18, though I've also tried 1.20).
The issue is that when I have it so the APR library loads successfully, then the Flash side of the application does not usually load. I'll have to hit refresh a bunch of times and eventually it will usually load, but normally I'll see either a black webpage that says "Done" or the loading progress bar never move. Only by repeatedly hitting refresh will the page load. It will load eventually by hitting refresh enough, but it is not consistent and this obviously will not work for our clients who have to clear their browser's cache every time.
This problem only exists on Solaris, our application works fine on Windows. We've tried multiple patch-levels of solaris, and have verified with the "ldd" command that the library that needs to be loaded has all its dependencies there.
We've verified it isn't our swf file's size by testing:
1) Our regular SWF (1660 kb).
2) A random large-ish SWF (950 kb).
3) A small SWF with one label component that says "Test" (277 kb).
All 3 were unable to load when JBoss was also loading the native library, and loaded just fine without it. We need the native library to load successfully for Granite to connect between the client and server though, so not loading it isn't an option (unless there's some way to use the NIO connector with JBoss, but it appears unsupported).... if there is a way to use the NIO connector then we shouldn't need the APR library.
Has anybody run into this before? Anybody have any ideas or recommendations?
Have you tried the jboss native libraries for Solaris ?
http://www.jboss.org/jbossweb/downloads/jboss-native-2-0-9.html

HTTP Filer Server: Single file, cross platform, drag drop and start

I asked a previous question here but after reading the answers realised I hadn't done a very good job of defining my requirements.
Here's what I'm after:
Cross platform
Drag, drop and start
Preferably a single file
So to sum up I want something that I can just drag into a folder, start up and then it will start servering over http the contents of that folder.
Hope someone knows of something.
Cheers,
Chris
Python implementation:
#!/usr/bin/env python
import SimpleHTTPServer, BaseHTTPServer
def launchServer(ports):
for port in ports:
try:
serv = BaseHTTPServer.HTTPServer(('', port), SimpleHTTPServer.SimpleHTTPRequestHandler)
except:
continue
else:
print ("Launched on port " + str(port))
serv.serve_forever()
raise Exception("No ports available")
launchServer([80] + range(8000, 9000))
For a Windows executable, run this:
python setup.py py2exe
setup.py:
from distutils.core import setup
import py2exe
setup(console=['minipywebd.py'])
On Linux, chmod a+x the python file.
I have found a some-what small web server in the form of a Firefox addon. It works on any platform that Firefox works on. It can be installed very quickly and can be ready to use in around 45 seconds (I timed myself from the time I started downloading to the time I served my first page). The server sets up a directory for you to use right after it is installed so you could just drag it there and start viewing the page instantly. It also has limited server-side scripting capabilities(SJS) included but can be extended with common languages such as php and Perl. I don't think this would be the server you would use to host Google but it seems to be what you're looking for.
The download is here
Well it is quite late to answer this one: but python afaik is not single file ;-)
TCL is!
Look at www.equi4.com for a tclkit or starkit. TCL can implement an HTTP server easily. But with a TCL starkit you can even pack the content to be served into the very same file as the webserver and the TCL interpreter and possibly extension.
Building a complete solution is no rocket science but you will have to read yourself into the thing a bit. TCL can be learned in two to three hours if you ever programmed anything before.

Resources