Click here to Skip to main content
15,895,370 members
Home / Discussions / C#
   

C#

 
GeneralRe: Error stop Http Listener Pin
George_George3-Jun-08 1:24
George_George3-Jun-08 1:24 
GeneralRe: Error stop Http Listener Pin
N a v a n e e t h3-Jun-08 1:40
N a v a n e e t h3-Jun-08 1:40 
GeneralRe: Error stop Http Listener Pin
George_George3-Jun-08 2:16
George_George3-Jun-08 2:16 
GeneralRe: Error stop Http Listener Pin
N a v a n e e t h3-Jun-08 2:30
N a v a n e e t h3-Jun-08 2:30 
GeneralRe: Error stop Http Listener Pin
George_George3-Jun-08 2:49
George_George3-Jun-08 2:49 
GeneralRe: Error stop Http Listener Pin
N a v a n e e t h3-Jun-08 7:03
N a v a n e e t h3-Jun-08 7:03 
GeneralRe: Error stop Http Listener Pin
George_George3-Jun-08 15:23
George_George3-Jun-08 15:23 
GeneralRe: Error stop Http Listener Pin
N a v a n e e t h3-Jun-08 15:33
N a v a n e e t h3-Jun-08 15:33 
Ok- Take a look at your StartListen() method (unwanted lines trimmed).
public void StartListen()
{
     IAsyncResult result;
     _Server.Start();
     while (true)
     {
        result = _Server.BeginGetContext(new AsyncCallback(this.HttpCallback), _Server);
        result.AsyncWaitHandle.WaitOne();
     }
}


Consider the following situation

1 - Loop starts for the first time, value of result will be NULL initially.
2 - It calls _Server.BeginGetContext, asynchronous method call starts and return immediatly.
3 - You call WaitOne() which blocks the loop, so it will wait until the processing finishes.
4 - When processing finishes it waits for next one.

So what will happen if another request comes during the execution of previous one ? It will be blocked in this case. Correct ?

All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia

How to use google | Ask smart questions

GeneralRe: Error stop Http Listener Pin
George_George3-Jun-08 15:49
George_George3-Jun-08 15:49 
GeneralRe: Error stop Http Listener Pin
N a v a n e e t h4-Jun-08 5:16
N a v a n e e t h4-Jun-08 5:16 
GeneralRe: Error stop Http Listener Pin
George_George4-Jun-08 20:34
George_George4-Jun-08 20:34 
GeneralRe: Error stop Http Listener Pin
N a v a n e e t h5-Jun-08 6:55
N a v a n e e t h5-Jun-08 6:55 
GeneralRe: Error stop Http Listener Pin
George_George5-Jun-08 14:44
George_George5-Jun-08 14:44 
GeneralRe: Error stop Http Listener Pin
N a v a n e e t h5-Jun-08 17:09
N a v a n e e t h5-Jun-08 17:09 
GeneralRe: Error stop Http Listener Pin
George_George5-Jun-08 18:50
George_George5-Jun-08 18:50 
AnswerRe: Error stop Http Listener Pin
GDavy2-Jun-08 22:38
GDavy2-Jun-08 22:38 
GeneralRe: Error stop Http Listener Pin
George_George2-Jun-08 22:44
George_George2-Jun-08 22:44 
GeneralRe: Error stop Http Listener Pin
GDavy2-Jun-08 23:01
GDavy2-Jun-08 23:01 
GeneralRe: Error stop Http Listener Pin
George_George2-Jun-08 23:32
George_George2-Jun-08 23:32 
GeneralRe: Error stop Http Listener Pin
suzuuu26-Apr-10 20:52
suzuuu26-Apr-10 20:52 
AnswerRe: Error stop Http Listener Pin
Zoltan Balazs3-Jun-08 1:14
Zoltan Balazs3-Jun-08 1:14 
GeneralRe: Error stop Http Listener Pin
George_George3-Jun-08 1:23
George_George3-Jun-08 1:23 
QuestionHow i create auto update application Pin
wasimsharp2-Jun-08 21:46
wasimsharp2-Jun-08 21:46 
AnswerRe: How i create auto update application Pin
Robert Rohde2-Jun-08 21:53
Robert Rohde2-Jun-08 21:53 
QuestionHow to find if media file is DRM protected or not ? Pin
Sharma Ritesh2-Jun-08 21:44
Sharma Ritesh2-Jun-08 21:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.