View Single Post
Old Nov 5th, 2004, 8:22 AM   #9
phrosys
Newbie
 
Join Date: Nov 2004
Posts: 24
Rep Power: 0 phrosys is on a distinguished road
Quote:
Originally posted by kurifu@Nov 4 2004, 05:41 AM
Actually thanks to BSD style sockets, the code the would work in linux generally also works on every Unice like machine, DOS and Windows. The only two WSA socket calls I make when using sockets in Windows is WSAStarup() and WSAShutdown() which are absolutely required to intialize and clean up the socket subsystem.

So really that article will give you a great start with Sockets coding in windows two, as long as you mind your type safety, and can figure out who to link the socket libraries in both operating environments.
using winsock is the fastest way to write a webserver in C (from the windows enviroment) ; sockets allow you to setup , send , recieve , destroy data/connections, they do/can NOT have anything to do with http or diagrany other protocols in the application layer (refer to the Protocol Stack).

so, i would suggest you read rfc 2616 which clearly defines the http protocol before you begin coding your server.

to have multi-user requests serviced at the same time you use threads (any maybe forks?), so whenever a new user connects you launch a new thread to service that request, this works because the way sockets operate is: users connect to a welcome socket (@ port 80 for http), subsequent communication is through another port (randomly selected)...this means that each new request has a different port, which can be serviced independent of any other requests.

sockets can be made quite portable, threads not so
phrosys is offline   Reply With Quote