-
C code along with server
hey community,
i'd like to know if anyone could tip me in the right direction in solving my problem.
i have a c program that runs fine in the command line.
but i have to integrate my algorithm into a server in order for others to easily access it.
i've tried several different approaches:
-adapting fastCGI library into my code in order to link it to nginx and send requests to my code. unfortunately i did not succeed in implementing this approach, due the fact that most likely that library is outdated (1996) and patching it makes no sense to me.
-also i've been playing around with socket programming and integrating them directly into my code. which kind of brought in more hassle instead of easing my task.
what im asking here is if anyone knows a faster, slicker and perhaps more elegant solution to binding C code to a server without writing a dedicated server/client model (which would probably result in more bugs in code)
thanks beforehand!
-
you can setup a very simple server, by having your program open a socket, and use input from the socket as if it was keyboard input. and flushing all your output to the socket. basicly making a telnet like shell.
even easyer would be write a program which will spawn a application with redirected stdin stdout and stderr pipes, which you direct to the socket connection.
but that requires knowing your operating system.