simple web servers in different languages. these are not safe or secure.
sources
compile and run server. curl or wget a GET request to localhost:8080/index.html
these man
pages on my Mac required number params
- bind:
man 2 bind
- sockaddr:
man 4 inet
bind wants type sockaddr
, but we create a sockaddr_in type, and cast it. info here
htons
will convert a number into hex and swap the endian-ness, for example, 8080 in hex is 1f90, swapping the bytes results in 901f. htons(8080) results in 0x901f.
when sending to a socket, write
is equivalent to send
if there are no flags set.