Learn C network programming with these examples.
On host
gcc wuts_my_ip.c -o server
./server
On remote client (that's on the same network as the host). Connect to the server
on the host using telnet
and the host's private ip address. The 9666 port is
hardcoded in the code example.
telnet 192.168.128.xxx 9666
> Listen to John Coltrane... By the way, your ip address is: 192.168.128.237
Learn how this works by reading the prodigiously documented source code
On host
gcc minimal_web_server.c -o server
sudo ./server
Now visit 127.0.0.1 on the browser and you should see this simple html page returned by the browser.
Learn how this works by reading the prodigiously documented source code
Hacking by Jon Erickson: http://www.amazon.com/Hacking-Art-Exploitation-Jon-Erickson/dp/1593271441
Beej's intro to network programming: http://beej.us/guide/bgnet/output/html/multipage/index.html
opengroup.org socket.h documentation: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/socket.h.html
opengroup.org arpa/inet.h documentation: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/arpa/inet.h.html
opengroup.org net/inet.h documentation: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/arpa/inet.h.html
Pull requests more than welcome. Especially if there are bugs, better ways to code things, better ways to explain things.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request