FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


help on threading





umeshtangnu
hi
i am making an http server
it has following functions
main()
{
if option is "-?", output the hints and stop
check the directory supplied is sensible and not a security risk
become a daemon process
ignore child programs (to avoid zombies when child processes stop)


create a socket, bind it to a port number and start listening to the
socket


forever {
wait and accept incoming socket connection
start a new thread
web function
else close new connection
}



}
log()
{
outputs error, sorry or log messages to the nweb.log file
if a sorry message, transmit it to the browser as a fake HTML response
if error or sorry message the program is stopped


}


web() - this function returns the request back to the browser
{
read from the socket the HTTP request
check it's a simple GET command
check no parent directory requested to escape the web servers home
directory
if no file name given assume index.html
check the file extension is valid and supported
check the file is readable by opening it
transmit the HTTP header to the browser
transmit the file contents to the browser
if LINUX sleep for one second to ensure the data arrives at the browser
stop
}
mine problem is how can i start a new thread for every new request i
recieve
plz help
Indi
Are you using C or C++?

What platform are you programming for? Linux? Multiple?

Are you using POSIX threads? Winsock?
Related topics
can i help?
help,Bonding
HELP!!
Help me with MySQL Account Maintenance and phpBB 2.0.15 :((
help, change pass my acc in cpanel
help me upgrade php to 5.
Need help adding a domain
help add admin in phpbb forum
How to solve this problem? Thanks
Help!
Help me change port for phptriad
problam Plz help
Help!!
Any help with C++?
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.