Skip to content

mayakraft/simple-servers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

simple web servers on MacOS

simple web servers in different languages. these are not safe or secure.

in C

sources

usage

compile and run server. curl or wget a GET request to localhost:8080/index.html

notes

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published