use of XMPP in flex code on UDP Protocol - c++

I am working private network.This alread developped product which implemented using TCP(client server technology).
Existing product is as follows
There is a UI which is developed using flex, where user can see video or snapshot
There is a server which is developed using c++,which redirects request from UI to gateway.
There is gateway which is connected with the Camera,which stream video to UI through server.
Now we wanted to add p2p technology to existing client server.So it will support TCP as Well As UDP.
Presently we are exploring flex and XMPP to implement the p2p.
as newer version flex of flex support p2p using RTMFP, but thats the propriety protocol of adobe.if we use RTMFP we need to change all the existing code that we dont want
I wanted to implemented to p2p using flex client(UI) which will use XMPP to communicate with Gateway and Server.
So the question is
Is it possible to use XMPP from flex code
Will XMPP support UDP p2p or not.

Yes. You can use the as3xmpp library to communicate to servers using that protocol.
To my knowledge, no. My understanding is that the network protocol used in p2p connections is internalized, and doesn't allow for public APIs to define their own network protocol (unlike Sockets for example).

Related

Java combining sockets with web services

I have an older statusing application that uses DataGramSockets to send/rec status messages from a number of programs. I want to convert this reporting app to use web services so it can also be queried from web pages.
Is it possible to have both the socket listening on its usual port while another service, second thread, listen to an http port for web connections?
You can easily use Java socket.io Library (for example) to use websocket/websocket secure over http/https.
So I will be using web sockets at this point. I see there really is no perfect answer to this question and its a little open ended. Ill get it closed.

libvncserver / libvncclient websocket support (to vSphere)?

I am trying to use libvnc to write client application for VMware ESXi 6 vm's consoles.
From ESXi 6 VMware provides websocket for this purpose. They are also released basic HTML5 client for this.
ESXi websocket VNC uses connection path to authorize.
When HTML5 client trying to connect it making request like this:
wss://esxi_host_ip/ticket/secret_token
From my research I know that this method also works with noVNC Client
(https://github.com/kanaka/noVNC)
This client passes "path" parameter to RFB implementation.
From libvnc website I know that it support websockets but I don't know if it is supported on client side and if the answer is YES, how can I do that ?
Finally the answer is NO but simple hack is possible.
Connection to websocket vnc server from libvnc is not directly possible.
As solution for my problem I used custom made tcp to websocket proxy where I firstly negotiating websocket connection and then connecting standard tcp vnc client.

How to make Qt Websocket and QNetworkRequest (HTTP) to use the same connection?

Is it possible with Qt to upgrade a HTTP connection that handles the normal HTTP requests to a Websocket with the same connection?
I'm thinking about something like this with Poco libraries, but all done in Qt similar to QtWebApp.
The simple answer is no and that is mostly because of specifics of the server side. And Qt just follows the protocol available and exposed by the server (HTTP/WebSocket) as mostly the client-side development framework and AFAIK won't be able to do the kind of transformation you want of going from HTTP to Websocket that are two different protocols. But of course, theoretically that can be done as long as both protocols able to use IP port 80. But that implies new unique sever and new unique client implementations.
We use both WebSocket and REST in our app. And WebSocket is for triggering the client by the server to do something. Client gets the "poke" from the server and starts normal JSON HTTP-based exchange with the server.
Somewhat relative link: https://softwareengineering.stackexchange.com/questions/276253/mixing-rest-and-websocket-in-the-same-api

Implementing a Client using Mongoose with C++

I know how to implement a server with Mongoose, in fact all information that I could find was about servers, but I need to know how do I implement a client.
Very basic, how to connect to a server is the main problem, the send functions are pretty straight forward.
Mongoose is a web server and AFAIK does not provide an API for client side http requests.
For C++ http client libraries, you might want to look at these answers:
What C++ library should I use to implement a HTTP client?
A better C++ HTTP client library
These sites also give a good overview about available C++ client libraries:
http://curl.haxx.se/libcurl/competitors.html
http://en.cppreference.com/w/cpp/links/libs
Mongoose actually does provide HTTP client functionality. See mg_connect() on http://cesanta.com/docs/API.shtml. Also, example HTTP client code is at https://github.com/cesanta/mongoose/tree/master/examples/http_client
I suggest using Fossa library (a superset of Mongoose), as it's HTTP client interface is more flexible. Example code is at https://github.com/cesanta/fossa/tree/master/examples/restful_client , documentation is at http://cesanta.com/docs/fossa/

Secure data transfer over http with custom server

I am pretty new to security aspect of application. I have a C++ window service (server) that listens to a particular port for http requests. The http requests can be made via ajax or C# client. Due to some scope change now we have to secure this communication between the clients and custom server written in C++.
Therefore i am looking for options to secure this communication. Can someone help me out with the possible approaches i can take to achieve this.
Thanks
Dpak
Given that you have an existing HTTP server (non-IIS) and you want to implement HTTPS (which is easy to screw up and hard to get right), you have a couple of options:
Rewrite your server as a COM object, and then put together an IIS webservice that calls your COM object to implement the webservice. With this done, you can then configure IIS to provide your webservice via HTTP and HTTPS.
Install a proxy server (Internet Security and Acceleration Server or Apache with mod_proxy) on the same host as your existing server and setup the proxy server to listen via HTTPS and then reverse proxy the requests to your service.
The second option requires little to no changes to your application; the first option is the better long-term architectural move.
Use HTTPS.
A good toolkit for securing your communication channel is OpenSSL.
That said, even with a toolkit, there are plenty of ways to make mistakes when implementing your security layer that can leave your data open to attack. You should consider using an existing https server and having it forward the requests to your server on the loopback channel.
It's reasonably easy to do this using either OpenSSL or Microsoft's SChannel SSPI interface.
How complex it is for you depends on how you've structured your server. If it's a traditional style BSD sockets 'select' type server then it should be fairly straight forward to take the examples from either OpenSSL or SChannel and get something working pretty quickly.
If you're using a more complex server design (async sockets, IOCP, etc) then it's a bit more work as the examples don't tend to show these things. I wrote an article for Windows Developer Magazine back in 2002 which is available here which shows how to use OpenSSL with async sockets and this code can be used to work with overlapped I/O and IOCP based servers if you need to.