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
sleep thread for 1 second
stop
}
mine problem is how can i start a new thread for every new request i
recieve
plz help 2 1944
Probably some hints here: http://www.asp.net/Projects/Cassini/...ndex=0&tabid=1
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
*************** *************** *************** **
Think Outside the Box!
*************** *************** *************** **
"lucifer" <um**********@g mail.com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. . 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 sleep thread for 1 second stop } mine problem is how can i start a new thread for every new request i recieve plz help
Hi,
You can use a sync queue for example, in your main thread (the one
accepting connections) each time a new connection is received the TcpClient
(or Socket) is stored in a Sync'd Queue, a new thread is spawn to execute
the serving methid, this method dequeue the first element from the queue and
it's the sockets it uses
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"lucifer" <um**********@g mail.com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. . 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 sleep thread for 1 second stop } mine problem is how can i start a new thread for every new request i recieve plz help This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Fuzzyman |
last post by:
In a nutshell - the question I'm asking is, how do I make a socket
conenction go via a proxy server ?
All our internet traffic has to go through a proxy-server at location
'dav-serv:8080' and I need to make a socket connection through it.
The reason (with code example) is as follows :
I am hacking "Tiny HTTP Proxy" by SUZUKI Hisao to make an http proxy
that modifies URLs. I haven't got very far - having started from zero
knowledge of...
|
by: Erwin S. Andreasen |
last post by:
I have a Python application server that manages several different data
sets, permits various reports to be run on them and the data to be
downloaded as tab-delimetered files, all via a web interface.
I'd like to explore the possibilities of making the data directly
available in Windows applications (such as Excel, where it would very
nice to directly do pivot tables from the live data) via ODBC.
So I basically need for my Python server...
|
by: Mark Adams |
last post by:
I am a relative newbie to MySQL. I had a Postfix+Courier+MySQL mail
server running for several months. It took me a week or so to get it up
and running in September. Now, I did a clean upgrade to Mandrake 9.2
and am reinstalling everything. This thing is kicking my ass and I
can't seem to get past it. I could really use some help if anybody has any.
Just for reference, this was my primary source for information on
installation and...
|
by: Paul Mason |
last post by:
Hi folks,
We have two servers running ASP.NET systems. One is live and one is
development. I have recently adopted an ASP system from a colleague to
nurse it back to health. On the development server it correctly interprets
dates as being british i.e. dd/mm/yyyy, but on the live server it reverts to
the usa format i.e. mm/dd/yy.
Both systems have the appropriate session variable set i.e. Session.LCID =
2057. Both servers have IIS...
|
by: McGrull |
last post by:
Sorry for my question, but I'm really a newbie on ASP.
I need to make a simple page (for IIS 5.0 and up, but even for 2000
Professional IIS) that read and display the files contained in a
specified directory and next, clicking on one of them, calling and
making an action with an another ASP page. For example:
http://server/list.asp
Listing Y:\REPOSITORY
| |
by: Charlie |
last post by:
Hi:
I'm working on an e-commerce site. Using the SMTP class, my site sends out
confirmation messages. It works most of the time, but sometimes raises an
error. I need a way of making sure it goes out every time. I thought about
wrapping a try-catch handler in loop that keeps on retrying if delivery
fails. Is this a good idea? If not, what is the best way of handling this
kind of thing?
Thanks,
|
by: Mike Cox |
last post by:
Hi.
As most of you know, comp.databases.postgresql.general is a wonderful
resource. What you may not know is that it has not gone through a
process that would enable it to be listed on hundreds of usenet
servers worldwide by default.
Normally groups that are under the comp.* hierarchy go through a
something called RFD and CFV. comp.databases.postgresql.general has
not gone through this process, therefore many servers refuse to carry
|
by: Yong |
last post by:
I get a general network error when I try to make asynchronously call
ExecuteNonQuery on long sql statements that run in parallel.
Here is the background info on what I'm trying to accomplish:
I have a sql file with two long T-SQL batches, each of which contains about
50 thousand simple insert statments into 2 non-indexed tables. Batch 1
inserts into Table 1 and batch 2 inserts into Table 2, so they can run in
parallel. I parse each...
|
by: Dan |
last post by:
Issue making textbox visible based on specific input from a radio button
list in an EditItemTemplate
I want to setup a gridview that when in edit mode and when the user
selects "Other" from a radiolist that a text box will appear and the
user can input text.
I can get the textbox to appear after selecting other in the radiolist;
however, the selected value in the radiolist disappears. I believe this
is due to the databind call.
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |