I'm part of the RoboCup SSL of my school and we try to simulate the entire game on the grSim simulator (https://github.com/mani-monaj/grSim).
grSim is a Qt application so I have used the Qt Network library to make a client/server app and receive Google protobuf data. (https://github.com/rjabaker/WarBots-StrategyTester/tree/master/tester/comm)
I have try to make the samething with SSL-refbox, I receive data, but it's not working when I try to print out the data, so I try to figure out why..
** So my question is: Can I use the Qt Network library to make a client/server app and receive data from a non-Qt interface (SSL-Refbox https://github.com/Hawk777/ssl-refbox/)**
Yes -- the Qt network library doesn't specify any particular protocol, it just shovels bytes around. So there is no reason a Qt-network-based server can't talk to a non-Qt-network-based client, or vice versa; you just have to make sure that they both speak the same protocol.
Related
Is it possible to use a Go API in a Qt C++ project?
I would like to use the following Google API written in Go: https://cloud.google.com/speech-to-text/docs/reference/libraries#client-libraries-install-go
Is it possible to use a Go API in a Qt C++ project?
It could be possible, but it might not be easy and would be very brittle to run Go and Qt code in the same process, since Go and Qt have very different thread (goroutine) and memory models.
However, Go has (in its standard library) many powerful packages to ease the development of server programs, in particular of HTTP or JSONRPC servers.
Perhaps you might consider running two different processes using inter-process communication facilities. Details are operating system specific. I assume you run Linux. Your Qt application could then start the Go program using QProcess and later communicate with it (behaving as a client to your Go specialized "server"-like program).
Then you could use HTTP or JSONRPC to remotely call your Go functions from your Qt application. You need some HTTP client library in Qt (it is there already under Qt Network, and you might also use libcurl) or some JSONRPC client library. Your Go program would be some specialized HTTP or JSONRPC server (and some Google Speech to Text client) and your Qt program would be its only client (and would start it). So your Go program would be some specialized proxy. You could even use pipe(7)-s, unix(7) sockets, or fifo(7)-s to increase the "privacy" of the communication channel.
If the Google Speech to Text API is huge (but it probably is not) you might use Go reflective or introspective abilities to generate some C++ glue code for Qt: go/ast, go/build, go/parser, go/importer, etc
BTW, it seems that Google Speech to Text protocol is using JSON with HTTP (it seems to be some Web API) and has a documented REST API, so you might directly code in C++ the relevant code doing that (of course you need to understand all the details of the protocol: relevant HTTP requests and JSON formats), without any Go code (or process). If you go that route, I recommend making your Qt (or C++) code for Google Speech to Text some separate free software library (to be able to get feedback and help from outside).
Background
For my project, I'm attempting to control an AUV using an Arduino mega with an ethernet shield that receives instruction from a laptop (running Windows). The server side (laptop) will be written in C++.
Since there'll only be a one to one network using TCP/IP, I am trying to avoid the use of routers in order to simplify the hardware. I found out that you could do a direct connection between two devices (with auto-MDIX).
Therefore...
I have briefly looked into Boost:asio but I think it's probably an overkill (because I won't need to consider multiple clients etc) crossover for what I'm trying to achieve here. Am I right?
Any advice would be appreciated! Thanks.
TL;DR:
Looking for a C++ networking library (that works on Windows) that allows a clean, simple code to do a one-to-one TCP/IP connection.
The simplest way is to set-up your arduino as a web server. See this example sektch for the details.
On your Windows box use a web client library.
This way you can test the arduino even without your client software using your browser.
Is it possible to remotely call c++ native functions from actionscript3 flex 4 application? Can some suggest any sample code? I'm fine with writing a Adobe AIR app. I found a blog giving some ideas, but there was no code
You can use the Socket class to set up a TCP connection to a server that happens to be a compiled C++ executable, and could even be running on the same machine (localhost), that is a very typical use of the Socket class.
But the way your question is worded, it sounds like you want your swf to make function calls to a C++ compiled DLL or similar, which is not possible. Macromedia's Director product allowed this sort of thing with its wonderful Xtras native plug-in architecture (COM based), but the Flash Player has no equivalent**.
**EDIT: Turns out there is some equivalent functionality available for the AIR 2 runtime environment. I'm adding this for the sake of completeness, even though you did not specify that your app is an AIR app.
Check out this Adobe post: http://blogs.adobe.com/cantrell/archives/2010/03/extending_air_applications_with_plugins.html
and this:
http://www.adobe.com/devnet/air/flex/quickstart/articles/interacting_with_native_process.html
also this example:
http://www.adobe.com/devnet/air/flex/articles/air_screenrecording.html
Have a look at Alchemy : http://labs.adobe.com/technologies/alchemy/
You can connect to a TCP server in Flash with the Socket class.
The security requirements for serving policy files can be a bear if you're working in Flash Player rather than AIR.
These examples may help, though I can't guarantee they're up to date for security requirements:
Adobe example: socket policy server
Adobe example: Telnet client
Im quite new on Android and I have some question for all of you who are experts!
Ok, my problem...
I implemented a client-server application based on socket programming. The server encode some packets, send them to the client through a socket and the clinet decode them.
I tested the code with two linux machines and it works fine but in my experiment it is required to include another node (this will be the Android). So the server (linux machine) will encode the packets and send through socket to client1(linux machine) and client2(Android).
For this reason I want to port the native binary of my code (which is in C++) to Android.
In which way could I do this?
Please give me some help!
Really im totally stucked!
Thanks,
Zenia
when you want to port native code C/C++ to android you want to look up android ndk and jni
http://developer.android.com/sdk/ndk/index.html
http://download.oracle.com/javase/1.5.0/docs/guide/jni/spec/functions.html
There are some examples in the ndk on how to do this.
be warned that C is fully supported but C++ support apis is very limited on android (the list is in the docs of the ndk) so you might have problems porting your code.
I would recommend using directly java if you can, since working with JNI is tedious lol
how else can you port this? start learning android i did a quick check noticed it's sdk uses java you can start by looking at
http://developer.android.com/reference/java/net/Socket.html
Thanks for the reply,
I first tried to write my own code totally in java using sockets, however i had to port some optimized libraries to Android and I could figure out how to do that (i could port a simple small library but not the one that I wanted). I gave up and I right now im trying to play with jni and ndk. however i dont know if indeed i could port my binary as it is non static (like hello world). Thats why im asking. if anyone else have some experince on that please let me know. thanks a lot,
Zenia
What you should probably do is install the SDK and NDK and build the hello-jni ndk example.
Then look up how to access the android logcat output from C, and write yourself a nice little printf-like wrapper for that (probably using the vargs version of the underlying function) so you can easily generate debug output from your native code.
Then graft your native executable onto the hello-jni example code, so you'll have a java wrapper that does very little other than start things with a call to the native code. Just remember not to do much processing in the UI thread or native code called under that thread, or you will risk an application not responding timeout.
It is also possible to (ab)use the ndk's gcc to produce stand alone native executables with no java wrapper, but this is discouraged. It's hard to find a reliable place to install them on a non-rooted phone, and android's process management isn't happy about unknown native processes. In other words, that's a path that's fine for personal experiments on your own device, but a difficult and non-future-proof one for an application deployed to others.
does somebody have instructions, how do to make a RTSP client with Qt? I have already heard of live555, but I don't know how to link it with Qt.
Is there another way?
I would like to do it with Qt, so that it also runs under Linux and other platformens.
To have a RTSP client, you need to process the RTSP protocol one way or another.
Live555 is one way to do that, it is just a C++ library that can be linked with other applications, including Qt. It is certainly possible to link Live555 with Qt.
Another way would be to write your own RTSP client based off the RFC spec .
The last option would be to just use the Phonon framework in Qt. http://doc.trolltech.com/4.6/phonon-overview.html (provided your Phonon backend will support RTSP). This is the easiest way as Qt and the system handle all the backend decoding of the media, integrates seamlessly with Qt and does not require extra libraries to be linked in with your app.