Piping executable stdout into websocket - websocket

I am trying to build a web based IDE with a capability of compiling sources in a browser. The issue I am dealing with how to get compiler like gcc or c++ running in a web browser. The idea is compiler is running on server and its output is sent to client using websocket. I've been looking into libs like Socket.IO however I am not sure how to pipe stdout of a binary executable into websocket. Any ideas or approaches?

I have found a github project called websocketd that does exactly what I wanted. However I settled on another solution. Thanks anyway :-D

Related

Remote Debugging Hosted Lua

I am using Lua 5.3, hosting it in a C++ application. The C++ application provides various functions to a running Lua script. I would like to allow users to debug their Lua, while it is running in my application. I believe this is possible, but I can not find any recent information on doing this, only for older versions of Lua and this does not seem to work.
Can anyone please help me to get debugging a Lua script running under my application up and running? Any help would be greatly appreciated.
Thank you!
The easiest way that I know of is to use ZeroBrane's remote debugging capabilities. Their document explains it pretty nicely, but for the sake of self-containment:
Set your embedded Lua's path/cpath to zerobrane's stuff, or copy the mobdebug.lua file to your sources.
Add require('mobdebug').start() to the beginning of your code
You should be able to debug now. After you start your program, breakpoints set in the Lua sources should get hit.
This approach works best if you use ZB to edit your Lua files, which implies using a different editor for the C++ part. I found this to work reasonably well in practice, though.

Xamarin Forms: How do I implement WebSockets?

We want to transfer data from a client to a server in realtime, so we have decided to go with WebSockets.
Using Xamarin.Forms it was surprisingly difficult to find a suitable WebSocket library.
The best match was "WebSocket4Net" because it is directly suggested on Xamarin's Homepage. However I was not able to install this library, because it only supports versions of .NET up to v4.0. (We are using v4.5)
Whenever I try to change the target framework of my PCLs from v4.5 to v4.0 I get loads of weird errors stating "Windows.Input library could not be found", "ObservableCollection could not be found" etc.
So we are currently using the library "WebSocket.Portable.Core", which although lacking some functionality worked out. However for some reason we can only receive one message. The event "MessageReceived" always is just called once.
Has anyone heard about such a problem with WebSockets? Maybe it is just time to use another library, but I just can't find one?
I also can't find any solution how to implement WebSockets natively for each platform.
WebSockets.PCL has a native implementation for each platform and it's well documented
https://github.com/NVentimiglia/WebSockets.Pcl

How to communicate between a Win32 Console application and an MFC application?

I have one Win32 console application which will be independent EXE and I have front-end designed in MFC.
I want to get the results of the Win32 application to be shown on my GUI. I searched a lot and found some techniques:
Named pipe
DDE
Shared memory
Are any of these an appropriate solution to my problem? Does anyone know of any other solution(s) that might be easier than those I mentioned?
If the output of the console exe is machine parsable, you can use CreateProcess() with pipes for standard input and output which you then parse and display in your UI.
You send also message from one application to another, it's quite simple. Look into WM_COPYDATA
http://msdn.microsoft.com/en-us/library/ms649011%28v=vs.85%29.aspx

WinInet C++ ftp template?

Starting from scratch, would like to create an ftp application using WinInet.
Looking for a real basic example in C++ that will compile and get me started.
Thanks.
There's a bunch of partial samples on DotNetHeaven that could be glued to together without much work.
You could potentially use the MFC CFTPConnection (Which wrap the wininet api) as well, samples here on DotNetHeaven as well.

Embed webserver in carbon bundle

I need to embed a tiny webserver in a compiled jsfl external library for Adobe Flash CS4 so that an outside process can communicate with it. The external library will be a Carbon bundle on Mac and a set of dlls on Windows, so the webserver will need to be embedded/loaded from C/C++ code with no external dependencies like Ruby. Most of the tiny webservers like fnord or mini-httpd have never been ported to the Mac or Windows but are mostly intended to be compiled on Linux. I was thinking of using a Lua based embedded webserver but not sure if that would work or not. Are there any embedded webservers that are easier than others to port to Windows and Mac?
All right, I finally answered this. After evaluating several webservers I found a gem, Mongoose. Mongoose is a very small embeddable web server written in C that compiles and runs easily on Linux, Mac, and Windows (there is an even a link in the wiki to getting it to run on the iPhone). Many webservers say they do this but Mongoose was really easy to get up and running. It just did exactly what I expected a little web server to do with minimal fuss. My previous approach, to use libevent or libev, I found a bit too hard, mostly because of threading issues I faced with my main GUI thread. Mongoose came with support for CGI and PHP but I actually found the C based handlers very easy to write so I stuck with that.
Webrick and Mongrel run on both.
I thought of one other idea that is easier than Lua that I will try: using a webserver built with libevent. All I really need to do is serve up one file and I don't need any other HTTP features so something like the following might work:
http://3.rdrail.net/blog/libevent-webserver-in-40-lines-of-c/
I will report back.

Resources