Click here to Skip to main content
15,902,777 members
Home / Discussions / C#
   

C#

 
GeneralRe: WS-addressing Pin
cpkilekofp29-Sep-08 4:06
cpkilekofp29-Sep-08 4:06 
GeneralRe: WS-addressing Pin
George_George30-Sep-08 1:48
George_George30-Sep-08 1:48 
GeneralRe: WS-addressing Pin
cpkilekofp30-Sep-08 7:04
cpkilekofp30-Sep-08 7:04 
GeneralRe: WS-addressing Pin
George_George30-Sep-08 22:31
George_George30-Sep-08 22:31 
GeneralRe: WS-addressing Pin
choopie17-Jan-09 11:07
choopie17-Jan-09 11:07 
GeneralRe: WS-addressing Pin
George_George18-Jan-09 20:34
George_George18-Jan-09 20:34 
GeneralRe: WS-addressing Pin
choopie22-Jan-09 10:36
choopie22-Jan-09 10:36 
QuestionHelp me about "BeginGetResponse" hang when HTTP server generate an "500" error. Pin
liubin_aluzi22-Sep-08 20:28
liubin_aluzi22-Sep-08 20:28 
I am writting a async HTTP post program, here is some code:

int c,cc=4096;

public static ManualResetEvent allDone = new ManualResetEvent(false);

FileStream fs = new FileStream( "file to post",.......);


asyncResult = request.BeginGetRequestStream(new AsyncCallback(GetRequestStreamCallback), requestState);
allDone.WaitOne();
allDone.Reset();
c = fs.Read(b, 0, cc);
AsyncCallback callback = new AsyncCallback(WriteCallback);
int n = 0;
while (c > 0)
{
    asyncResult = requestState.dataStream.BeginWrite(b, 0, c, callback, requestState);
    requestState.waitHandle = ThreadPool.RegisterWaitForSingleObject(allDone, new WaitOrTimerCallback(TimeoutCallback), requestState, 3000, true);
    allDone.WaitOne();
    allDone.Reset();
    c = fs.Read(b, 0, cc);
}
requestState.dataStream.Close();

//NOTE:if remove the following line, the BeginGetResponse will hang
Thread.Sleep(1000);

asyncResult = request.BeginGetResponse(new AsyncCallback(GetResponseCallback), requestState);
allDone.WaitOne();
allDone.Reset();


The code above I tested ok, it can upload file to the http server, and I also can get the http server's response.

but If I post some file that will cause HTTP server generate 500 error, the code will hang in BeginGetResponse call, never return until I kill it's process.

I hope that BeginGetResponse can get error message from http server, not hang and dead....
AnswerRe: Help me about "BeginGetResponse" hang when HTTP server generate an "500" error. Pin
liubin_aluzi22-Sep-08 20:52
liubin_aluzi22-Sep-08 20:52 
QuestionCapture and Save Image Pin
sirisha guttikonda22-Sep-08 19:43
sirisha guttikonda22-Sep-08 19:43 
AnswerRe: Capture and Save Image Pin
N a v a n e e t h22-Sep-08 19:54
N a v a n e e t h22-Sep-08 19:54 
AnswerRe: Capture and Save Image Pin
Harvey Saayman22-Sep-08 20:53
Harvey Saayman22-Sep-08 20:53 
GeneralRe: Capture and Save Image Pin
Monark23-Sep-08 15:00
Monark23-Sep-08 15:00 
GeneralRe: Capture and Save Image Pin
Harvey Saayman23-Sep-08 23:21
Harvey Saayman23-Sep-08 23:21 
Questionvb vs c# variables in sql query strings [reform my question] Pin
Rafone22-Sep-08 19:34
Rafone22-Sep-08 19:34 
AnswerRe: vb vs c# variables in sql query strings Pin
N a v a n e e t h22-Sep-08 19:57
N a v a n e e t h22-Sep-08 19:57 
AnswerRe: vb vs c# variables in sql query strings Pin
Nirandas22-Sep-08 20:43
Nirandas22-Sep-08 20:43 
GeneralRe: vb vs c# variables in sql query strings Pin
Rafone23-Sep-08 3:33
Rafone23-Sep-08 3:33 
GeneralRe: vb vs c# variables in sql query strings Pin
Nirandas23-Sep-08 4:10
Nirandas23-Sep-08 4:10 
GeneralRe: vb vs c# variables in sql query strings [modified] Pin
Rafone23-Sep-08 4:40
Rafone23-Sep-08 4:40 
GeneralRe: vb vs c# variables in sql query strings Pin
cpkilekofp24-Sep-08 7:16
cpkilekofp24-Sep-08 7:16 
GeneralRe: vb vs c# variables in sql query strings Pin
Rafone24-Sep-08 10:41
Rafone24-Sep-08 10:41 
QuestionRotation of cube Pin
aurosikhadas22-Sep-08 19:21
aurosikhadas22-Sep-08 19:21 
AnswerRe: Rotation of cube Pin
Roger Alsing22-Sep-08 20:17
Roger Alsing22-Sep-08 20:17 
AnswerRe: Rotation of cube Pin
Harvey Saayman22-Sep-08 20:48
Harvey Saayman22-Sep-08 20:48 

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.