How to respond to a http get in native c++ linux -


i'm totally new programming c++ linux, i'd make following;

console application handle , echo parameters of incommoding http request.

but first step be;

so if open browser , a;

http://192.168.2.10/?yadda=1 

on linux system on 192.168.2.10, echo on screen

new incomming web request parameters: yadda=1 

i've done few times .net http listener, i'm totally clueless on how c++ in linux.

thanks help!

(no netcat, no vmware under linux running .net httplistener, no echo-ing piping, script solution, emulation or whatever, want know how in c++ under linux)

in other words;

dim listener new httplistener() listener.prefixes.add("http://localhost/") dim context httplistenercontext = listener.getcontext 

in linux using c++ create binairy executable. actual lines of c++ code helpfull. thanks

1) can wire pretty netcat (nc) on linux without writing network code.

nc can run in server mode, , can pipe input / output program, c++ console program.

2) can use inetd / xinetd turn console program network daemon. configure program specific port (in inetd config file) , work of listening connections, , execs c++ program socket descriptor duped stdin/stdout use standard input / output calls. that, again, lets write network program, without knowing sockets. here example: linux: how make daemon/service usable xinetd?

i start option 2, works, , can prototype going within minutes let focus on console echo functionality, if need later, can revisit things , write full network daemon.

3) remembered libcurl (http://curl.haxx.se/libcurl/c/), works well. schepurin mentioning in comments. have used on linux. c, can wrap in c++ easier wrapping berkeley api.

other that, going using berkeley (bsd) / posix sockets (http://en.wikipedia.org/wiki/berkeley_sockets) calls on linux, or there may nice c++ library out there. can send mine offline if like. best book know late w. richard stevens famous book, unix network programming, , related series.

i thought i'd throw first 2 ideas out there since said weren't sure start c++, might started faster.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -