473,320 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

HttpWebResponse's GetResponse() hangs and timeouts

This is a copy of a message at microsoft.public.dotnet.framework.clr:

THE CODE:

I'm using an HttpWebResponse object to send an HTTP POST to a Java server I have written and are running on the same machine (for dev and testing). Here is the C# code snippet:

1 string clientAddr = "http://127.0.0.1:22225/";
2 try
3 {
4 webreq = (HttpWebRequest)WebRequest.Create( clientAddr );
5 //webreq.Proxy = GlobalProxySelection.GetEmptyWebProxy();
6 webreq.Method="POST";
7 ASCIIEncoding encoding = new ASCIIEncoding();
8 byte[] outGoingBytes = encoding.GetBytes( _msg );
9 webreq.ContentType = "application/x-www-form-urlencoded";
10 //webreq.KeepAlive = false;
11 // Set the content length of the string being posted.
12 webreq.ContentLength = outGoingBytes.Length;
13 //webreq.AllowWriteStreamBuffering = false;
14 //webreq.Timeout = 15000;
15 Stream outGoingStream = webreq.GetRequestStream();
16 outGoingStream.Write(outGoingBytes, 0 , outGoingBytes.Length);
17 outGoingStream.Flush();
18 outGoingStream.Close();

19 webresp = (HttpWebResponse)webreq.GetResponse();
20 Stream streamResponse = webresp.GetResponseStream();
21 Encoding UTF8Encoding = System.Text.Encoding.GetEncoding("utf-8");
22 StreamReader streamRead = new StreamReader( streamResponse, UTF8Encoding );
23 Char[] readBuff = new Char[256];
24 int count = streamRead.Read( readBuff, 0, 256 );
25 Console.WriteLine("The return stream is: ");
26 while (count > 0)
27 {
28 String outputData = new String(readBuff, 0, count);
29 Console.Write(outputData);
30 count = streamRead.Read(readBuff, 0, 256);
31 }
32 Console.WriteLine();
33 // Close the Stream object.
34 streamResponse.Close();
35 streamRead.Close();
36 // Release the resources held by response object.
37 webresp.Close();
38 }
39 catch( System.Net.WebException we )
40 {
41 Console.WriteLine( "Error with client [" + clientAddr + "]: " +
42 we.ToString() + "\n" + we.StackTrace );
43 if( webresp != null )
44 webresp.Close();
45 }

[Line numbers changed for simplicity]

PROBLEM DESCRIPTION:

The C# code should create an HTTP Header and POST with _msg at Line 8 as the content and send it to port 22225 on the same machine. What happens is at Line 16 the HttpWebRequest creates the socket and sends ONLY the HTTP Header and HTTP Delimiter ( "\r\n\r\n" ). The Java server gets the Header and the Header's delimiter. Then, the C# program proceeds to line 19 and hangs. The Java server blocks on it's socket during the hang. C# hangs until the socket timeout is reached and then triggers the following message:

Error with sending a message to client [http://127.0.0.1:22225/]: System.Net.WebException: The operation has timed-out.
at System.Net.HttpWebRequest.GetResponse()
at Msg4Client.processMessage() in \...\clientsrv.cs:line 19
at System.Net.HttpWebRequest.GetResponse()
at Msg4Client.processMessage() in \...\clientsrv.cs:line 19

At this exact moment, the Java server I wrote gets the body of the POST (contents of _msg) in it's entirity. But, the C# program's thread is now dead and can't receive a response from the Java server because of the exception and lack of webresp being returned on line 19.

Does anyone know why the GetResponse() is hanging and then sends the POST's body at the timeout? Why is the GetResponse WebException being cited twice in the call stack? This is a multithreaded call, but at the time of testing there is only one Msg4Client thread.

SOLUTIONS WHICH DON'T WORK

I've tried the following things which have not worked. 1) I played with the proxy setting at Line 5. This connection shouldn't even have to use a proxy since it's on the same system. But setting no proxy or using the default proxy doesn't affect this problem. 2) I played with the KeepAlive setting at Line 10, but both true and false still show this problem. 3) AllowWriteStreamBuffering at Line 13 has no affect either true or false. 4) Setting the timeout on Line 14 only lengths or shortens the hang period - that is all. 5) Inserting a System.GC.Collect() above Line 19 doesn't help either.

ISN'T THE JAVA AT FAULT?

It's obviously possible the Java server is the problem, but I don't think so. Here's why: I'm using a ServerSocket to listen to port 22225 and it accepts the C#'s connection just fine. It also get's the header and header delimiter from C# just fine, but if I read in from the DataInputStream in bytes or BufferedReader in readLines they both block on the socket until C# hit's a timeout and still returns the POST's entire contents only after that timeout. I think that the C# doesn't acutally send it's content until the timeout is triggered, because Java blocks on the socket until that timeout happens even reading byte by byte, then it returns the data after C#'s timeout.

Bizarre. Any help would be appreciated!

-Nathan
Nov 15 '05 #1
5 35641
Nathan ,

Just prior to instantiating the web request, try adding the following line:

int tmp = ServicePointManager.DefaultConnectionLimit
This will force a load of the config files and should prevent the socket
from hanging. This 'type' of problem is a known issue with MS C# sockets.
If you haven't considered it already, I would suggest looking at the
TCPClient class. I had a similar issue and got around the problem with the
above solution.

Alex
"Nathan" <go****@waitefamily.com> wrote in message
news:vn************@corp.supernews.com...
This is a copy of a message at microsoft.public.dotnet.framework.clr:

THE CODE:

I'm using an HttpWebResponse object to send an HTTP POST to a Java server I
have written and are running on the same machine (for dev and testing).
Here is the C# code snippet:

1 string clientAddr = "http://127.0.0.1:22225/";
2 try
3 {
4 webreq = (HttpWebRequest)WebRequest.Create( clientAddr );
5 //webreq.Proxy = GlobalProxySelection.GetEmptyWebProxy();
6 webreq.Method="POST";
7 ASCIIEncoding encoding = new ASCIIEncoding();
8 byte[] outGoingBytes = encoding.GetBytes( _msg );
9 webreq.ContentType = "application/x-www-form-urlencoded";
10 //webreq.KeepAlive = false;
11 // Set the content length of the string being posted.
12 webreq.ContentLength = outGoingBytes.Length;
13 //webreq.AllowWriteStreamBuffering = false;
14 //webreq.Timeout = 15000;
15 Stream outGoingStream = webreq.GetRequestStream();
16 outGoingStream.Write(outGoingBytes, 0 , outGoingBytes.Length);
17 outGoingStream.Flush();
18 outGoingStream.Close();

19 webresp = (HttpWebResponse)webreq.GetResponse();
20 Stream streamResponse = webresp.GetResponseStream();
21 Encoding UTF8Encoding = System.Text.Encoding.GetEncoding("utf-8");
22 StreamReader streamRead = new StreamReader( streamResponse,
UTF8Encoding );
23 Char[] readBuff = new Char[256];
24 int count = streamRead.Read( readBuff, 0, 256 );
25 Console.WriteLine("The return stream is: ");
26 while (count > 0)
27 {
28 String outputData = new String(readBuff, 0, count);
29 Console.Write(outputData);
30 count = streamRead.Read(readBuff, 0, 256);
31 }
32 Console.WriteLine();
33 // Close the Stream object.
34 streamResponse.Close();
35 streamRead.Close();
36 // Release the resources held by response object.
37 webresp.Close();
38 }
39 catch( System.Net.WebException we )
40 {
41 Console.WriteLine( "Error with client [" + clientAddr + "]: " +
42 we.ToString() + "\n" + we.StackTrace );
43 if( webresp != null )
44 webresp.Close();
45 }

[Line numbers changed for simplicity]

PROBLEM DESCRIPTION:

The C# code should create an HTTP Header and POST with _msg at Line 8 as the
content and send it to port 22225 on the same machine. What happens is at
Line 16 the HttpWebRequest creates the socket and sends ONLY the HTTP Header
and HTTP Delimiter ( "\r\n\r\n" ). The Java server gets the Header and the
Header's delimiter. Then, the C# program proceeds to line 19 and hangs.
The Java server blocks on it's socket during the hang. C# hangs until the
socket timeout is reached and then triggers the following message:

Error with sending a message to client [http://127.0.0.1:22225/]:
System.Net.WebException: The operation has timed-out.
at System.Net.HttpWebRequest.GetResponse()
at Msg4Client.processMessage() in \...\clientsrv.cs:line 19
at System.Net.HttpWebRequest.GetResponse()
at Msg4Client.processMessage() in \...\clientsrv.cs:line 19

At this exact moment, the Java server I wrote gets the body of the POST
(contents of _msg) in it's entirity. But, the C# program's thread is now
dead and can't receive a response from the Java server because of the
exception and lack of webresp being returned on line 19.

Does anyone know why the GetResponse() is hanging and then sends the POST's
body at the timeout? Why is the GetResponse WebException being cited twice
in the call stack? This is a multithreaded call, but at the time of testing
there is only one Msg4Client thread.

SOLUTIONS WHICH DON'T WORK

I've tried the following things which have not worked. 1) I played with the
proxy setting at Line 5. This connection shouldn't even have to use a proxy
since it's on the same system. But setting no proxy or using the default
proxy doesn't affect this problem. 2) I played with the KeepAlive setting
at Line 10, but both true and false still show this problem. 3)
AllowWriteStreamBuffering at Line 13 has no affect either true or false. 4)
Setting the timeout on Line 14 only lengths or shortens the hang period -
that is all. 5) Inserting a System.GC.Collect() above Line 19 doesn't help
either.

ISN'T THE JAVA AT FAULT?

It's obviously possible the Java server is the problem, but I don't think
so. Here's why: I'm using a ServerSocket to listen to port 22225 and it
accepts the C#'s connection just fine. It also get's the header and header
delimiter from C# just fine, but if I read in from the DataInputStream in
bytes or BufferedReader in readLines they both block on the socket until C#
hit's a timeout and still returns the POST's entire contents only after that
timeout. I think that the C# doesn't acutally send it's content until the
timeout is triggered, because Java blocks on the socket until that timeout
happens even reading byte by byte, then it returns the data after C#'s
timeout.

Bizarre. Any help would be appreciated!

-Nathan
Nov 15 '05 #2
Nathan ,

Just prior to instantiating the web request, try adding the following line:

int tmp = ServicePointManager.DefaultConnectionLimit
This will force a load of the config files and should prevent the socket
from hanging. This 'type' of problem is a known issue with MS C# sockets.
If you haven't considered it already, I would suggest looking at the
TCPClient class. I had a similar issue and got around the problem with the
above solution.

Alex
"Nathan" <go****@waitefamily.com> wrote in message
news:vn************@corp.supernews.com...
This is a copy of a message at microsoft.public.dotnet.framework.clr:

THE CODE:

I'm using an HttpWebResponse object to send an HTTP POST to a Java server I
have written and are running on the same machine (for dev and testing).
Here is the C# code snippet:

1 string clientAddr = "http://127.0.0.1:22225/";
2 try
3 {
4 webreq = (HttpWebRequest)WebRequest.Create( clientAddr );
5 //webreq.Proxy = GlobalProxySelection.GetEmptyWebProxy();
6 webreq.Method="POST";
7 ASCIIEncoding encoding = new ASCIIEncoding();
8 byte[] outGoingBytes = encoding.GetBytes( _msg );
9 webreq.ContentType = "application/x-www-form-urlencoded";
10 //webreq.KeepAlive = false;
11 // Set the content length of the string being posted.
12 webreq.ContentLength = outGoingBytes.Length;
13 //webreq.AllowWriteStreamBuffering = false;
14 //webreq.Timeout = 15000;
15 Stream outGoingStream = webreq.GetRequestStream();
16 outGoingStream.Write(outGoingBytes, 0 , outGoingBytes.Length);
17 outGoingStream.Flush();
18 outGoingStream.Close();

19 webresp = (HttpWebResponse)webreq.GetResponse();
20 Stream streamResponse = webresp.GetResponseStream();
21 Encoding UTF8Encoding = System.Text.Encoding.GetEncoding("utf-8");
22 StreamReader streamRead = new StreamReader( streamResponse,
UTF8Encoding );
23 Char[] readBuff = new Char[256];
24 int count = streamRead.Read( readBuff, 0, 256 );
25 Console.WriteLine("The return stream is: ");
26 while (count > 0)
27 {
28 String outputData = new String(readBuff, 0, count);
29 Console.Write(outputData);
30 count = streamRead.Read(readBuff, 0, 256);
31 }
32 Console.WriteLine();
33 // Close the Stream object.
34 streamResponse.Close();
35 streamRead.Close();
36 // Release the resources held by response object.
37 webresp.Close();
38 }
39 catch( System.Net.WebException we )
40 {
41 Console.WriteLine( "Error with client [" + clientAddr + "]: " +
42 we.ToString() + "\n" + we.StackTrace );
43 if( webresp != null )
44 webresp.Close();
45 }

[Line numbers changed for simplicity]

PROBLEM DESCRIPTION:

The C# code should create an HTTP Header and POST with _msg at Line 8 as the
content and send it to port 22225 on the same machine. What happens is at
Line 16 the HttpWebRequest creates the socket and sends ONLY the HTTP Header
and HTTP Delimiter ( "\r\n\r\n" ). The Java server gets the Header and the
Header's delimiter. Then, the C# program proceeds to line 19 and hangs.
The Java server blocks on it's socket during the hang. C# hangs until the
socket timeout is reached and then triggers the following message:

Error with sending a message to client [http://127.0.0.1:22225/]:
System.Net.WebException: The operation has timed-out.
at System.Net.HttpWebRequest.GetResponse()
at Msg4Client.processMessage() in \...\clientsrv.cs:line 19
at System.Net.HttpWebRequest.GetResponse()
at Msg4Client.processMessage() in \...\clientsrv.cs:line 19

At this exact moment, the Java server I wrote gets the body of the POST
(contents of _msg) in it's entirity. But, the C# program's thread is now
dead and can't receive a response from the Java server because of the
exception and lack of webresp being returned on line 19.

Does anyone know why the GetResponse() is hanging and then sends the POST's
body at the timeout? Why is the GetResponse WebException being cited twice
in the call stack? This is a multithreaded call, but at the time of testing
there is only one Msg4Client thread.

SOLUTIONS WHICH DON'T WORK

I've tried the following things which have not worked. 1) I played with the
proxy setting at Line 5. This connection shouldn't even have to use a proxy
since it's on the same system. But setting no proxy or using the default
proxy doesn't affect this problem. 2) I played with the KeepAlive setting
at Line 10, but both true and false still show this problem. 3)
AllowWriteStreamBuffering at Line 13 has no affect either true or false. 4)
Setting the timeout on Line 14 only lengths or shortens the hang period -
that is all. 5) Inserting a System.GC.Collect() above Line 19 doesn't help
either.

ISN'T THE JAVA AT FAULT?

It's obviously possible the Java server is the problem, but I don't think
so. Here's why: I'm using a ServerSocket to listen to port 22225 and it
accepts the C#'s connection just fine. It also get's the header and header
delimiter from C# just fine, but if I read in from the DataInputStream in
bytes or BufferedReader in readLines they both block on the socket until C#
hit's a timeout and still returns the POST's entire contents only after that
timeout. I think that the C# doesn't acutally send it's content until the
timeout is triggered, because Java blocks on the socket until that timeout
happens even reading byte by byte, then it returns the data after C#'s
timeout.

Bizarre. Any help would be appreciated!

-Nathan
Nov 15 '05 #3
Hi Alex,

Thanks for playing Jeopardy with me ;-) I put "int tmp =
ServicePointManager.DefaultConnectionLimit" at Line 2 in the code, but the
timeout error and POST body dump still occurred. I have the same feeling
you do: I'm going to have to rewrite this code using TCPClient. I did a
google group search for WebException Timeout and GetResponse() and got 69
hits. Over five of the responses from Microsoft's team stated issues with
bugs in .Net and their WebResponse class. Most of the bugs being different
issues too. .Net is showing it's youth. I'll start recoding it, but if you
or anyone else has any ideas, I'd love to hear 'em!

Thanks,
Nathan

"Trebek" <tr****@nospam.com> wrote in message
news:It*******************@fe3.columbus.rr.com...
Nathan ,

Just prior to instantiating the web request, try adding the following line:
int tmp = ServicePointManager.DefaultConnectionLimit
This will force a load of the config files and should prevent the socket
from hanging. This 'type' of problem is a known issue with MS C# sockets.
If you haven't considered it already, I would suggest looking at the
TCPClient class. I had a similar issue and got around the problem with the above solution.

Alex
"Nathan" <go****@waitefamily.com> wrote in message
news:vn************@corp.supernews.com...
This is a copy of a message at microsoft.public.dotnet.framework.clr:

THE CODE:

I'm using an HttpWebResponse object to send an HTTP POST to a Java server I have written and are running on the same machine (for dev and testing).
Here is the C# code snippet:

1 string clientAddr = "http://127.0.0.1:22225/";
2 try
3 {
4 webreq = (HttpWebRequest)WebRequest.Create( clientAddr );
5 //webreq.Proxy = GlobalProxySelection.GetEmptyWebProxy();
6 webreq.Method="POST";
7 ASCIIEncoding encoding = new ASCIIEncoding();
8 byte[] outGoingBytes = encoding.GetBytes( _msg );
9 webreq.ContentType = "application/x-www-form-urlencoded";
10 //webreq.KeepAlive = false;
11 // Set the content length of the string being posted.
12 webreq.ContentLength = outGoingBytes.Length;
13 //webreq.AllowWriteStreamBuffering = false;
14 //webreq.Timeout = 15000;
15 Stream outGoingStream = webreq.GetRequestStream();
16 outGoingStream.Write(outGoingBytes, 0 , outGoingBytes.Length);
17 outGoingStream.Flush();
18 outGoingStream.Close();

19 webresp = (HttpWebResponse)webreq.GetResponse();
20 Stream streamResponse = webresp.GetResponseStream();
21 Encoding UTF8Encoding = System.Text.Encoding.GetEncoding("utf-8");
22 StreamReader streamRead = new StreamReader( streamResponse,
UTF8Encoding );
23 Char[] readBuff = new Char[256];
24 int count = streamRead.Read( readBuff, 0, 256 );
25 Console.WriteLine("The return stream is: ");
26 while (count > 0)
27 {
28 String outputData = new String(readBuff, 0, count);
29 Console.Write(outputData);
30 count = streamRead.Read(readBuff, 0, 256);
31 }
32 Console.WriteLine();
33 // Close the Stream object.
34 streamResponse.Close();
35 streamRead.Close();
36 // Release the resources held by response object.
37 webresp.Close();
38 }
39 catch( System.Net.WebException we )
40 {
41 Console.WriteLine( "Error with client [" + clientAddr + "]: " +
42 we.ToString() + "\n" + we.StackTrace );
43 if( webresp != null )
44 webresp.Close();
45 }

[Line numbers changed for simplicity]

PROBLEM DESCRIPTION:

The C# code should create an HTTP Header and POST with _msg at Line 8 as the content and send it to port 22225 on the same machine. What happens is at
Line 16 the HttpWebRequest creates the socket and sends ONLY the HTTP Header and HTTP Delimiter ( "\r\n\r\n" ). The Java server gets the Header and the Header's delimiter. Then, the C# program proceeds to line 19 and hangs.
The Java server blocks on it's socket during the hang. C# hangs until the
socket timeout is reached and then triggers the following message:

Error with sending a message to client [http://127.0.0.1:22225/]:
System.Net.WebException: The operation has timed-out.
at System.Net.HttpWebRequest.GetResponse()
at Msg4Client.processMessage() in \...\clientsrv.cs:line 19
at System.Net.HttpWebRequest.GetResponse()
at Msg4Client.processMessage() in \...\clientsrv.cs:line 19

At this exact moment, the Java server I wrote gets the body of the POST
(contents of _msg) in it's entirity. But, the C# program's thread is now
dead and can't receive a response from the Java server because of the
exception and lack of webresp being returned on line 19.

Does anyone know why the GetResponse() is hanging and then sends the POST's body at the timeout? Why is the GetResponse WebException being cited twice in the call stack? This is a multithreaded call, but at the time of testing there is only one Msg4Client thread.

SOLUTIONS WHICH DON'T WORK

I've tried the following things which have not worked. 1) I played with the proxy setting at Line 5. This connection shouldn't even have to use a proxy since it's on the same system. But setting no proxy or using the default
proxy doesn't affect this problem. 2) I played with the KeepAlive setting
at Line 10, but both true and false still show this problem. 3)
AllowWriteStreamBuffering at Line 13 has no affect either true or false. 4) Setting the timeout on Line 14 only lengths or shortens the hang period -
that is all. 5) Inserting a System.GC.Collect() above Line 19 doesn't help either.

ISN'T THE JAVA AT FAULT?

It's obviously possible the Java server is the problem, but I don't think
so. Here's why: I'm using a ServerSocket to listen to port 22225 and it
accepts the C#'s connection just fine. It also get's the header and header delimiter from C# just fine, but if I read in from the DataInputStream in
bytes or BufferedReader in readLines they both block on the socket until C# hit's a timeout and still returns the POST's entire contents only after that timeout. I think that the C# doesn't acutally send it's content until the
timeout is triggered, because Java blocks on the socket until that timeout
happens even reading byte by byte, then it returns the data after C#'s
timeout.

Bizarre. Any help would be appreciated!

-Nathan

Nov 15 '05 #4
"Nathan" <go****@waitefamily.com> wrote in message news:<vn************@corp.supernews.com>...
This is a copy of a message at microsoft.public.dotnet.framework.clr:

PROBLEM DESCRIPTION:

The C# code should create an HTTP Header and POST with msg at Line 8 as
the content and send it to port 22225 on the same machine. What happens
is at Line 16 the HttpWebRequest creates the socket and sends ONLY the
HTTP Header and HTTP Delimiter ( "\r\n\r\n" ). The Java server gets the
Header and the Header's delimiter. Then, the C# program proceeds to
line 19 and hangs. The Java server blocks on it's socket during the
hang. C# hangs until the socket timeout is reached and then triggers
the following message:

Nathan -

Are you sure your Java code follows the specs for a valid HTTP 1.1
server? From RFC 2616:

"Requirements for HTTP/1.1 origin servers:

- Upon receiving a request which includes an Expect
request-header
field with the "100-continue" expectation, an origin server
MUST
either respond with 100 (Continue) status and continue to read
from the input stream, or respond with a final status code.
The
origin server MUST NOT wait for the request body before
sending
the 100 (Continue) response. If it responds with a final
status
code, it MAY close the transport connection or it MAY continue
to read and discard the rest of the request. It MUST NOT
perform the requested method if it returns a final status
code."

Under HTTP 1.1 (which is what the WebRequest is using), the data
does not have to be contained in the same HTTP message as the POST
command. The server must recognize that and send a "100 Continue"
status response. Obviously your server did not do that, thus the
logjam. Hope this helps shed some light on your problem. Good luck
with your HTTP server and client.

Rich Blum - Author
"C# Network Programming" (Sybex)
http://www.sybex.com/sybexbooks.nsf/Booklist/4176
"Network Performance Open Source Toolkit" (Wiley)
http://www.wiley.com/WileyCDA/WileyT...471433012.html
Nov 15 '05 #5
Rich, You're Da Man!

You just sold me on your book ;-) The Java server was the problem, as I was
implementing it using RFC 2068 and not the newer RFC 2616 which .NET
obviously uses. Hence, GetResponse was waiting for my Java server to send
it a "100 (Continue)" response before it would sent me the body. After
sending me the continue, the body proceeded just fine.

Thanks for your post!

Nathan

"Rich Blum" <ri*******@juno.com> wrote in message
news:cc**************************@posting.google.c om...
"Nathan" <go****@waitefamily.com> wrote in message

news:<vn************@corp.supernews.com>...
This is a copy of a message at microsoft.public.dotnet.framework.clr:

PROBLEM DESCRIPTION:

The C# code should create an HTTP Header and POST with msg at Line 8 as
the content and send it to port 22225 on the same machine. What happens
is at Line 16 the HttpWebRequest creates the socket and sends ONLY the
HTTP Header and HTTP Delimiter ( "\r\n\r\n" ). The Java server gets the
Header and the Header's delimiter. Then, the C# program proceeds to
line 19 and hangs. The Java server blocks on it's socket during the
hang. C# hangs until the socket timeout is reached and then triggers
the following message:

Nathan -

Are you sure your Java code follows the specs for a valid HTTP 1.1
server? From RFC 2616:

"Requirements for HTTP/1.1 origin servers:

- Upon receiving a request which includes an Expect
request-header
field with the "100-continue" expectation, an origin server
MUST
either respond with 100 (Continue) status and continue to read
from the input stream, or respond with a final status code.
The
origin server MUST NOT wait for the request body before
sending
the 100 (Continue) response. If it responds with a final
status
code, it MAY close the transport connection or it MAY continue
to read and discard the rest of the request. It MUST NOT
perform the requested method if it returns a final status
code."

Under HTTP 1.1 (which is what the WebRequest is using), the data
does not have to be contained in the same HTTP message as the POST
command. The server must recognize that and send a "100 Continue"
status response. Obviously your server did not do that, thus the
logjam. Hope this helps shed some light on your problem. Good luck
with your HTTP server and client.

Rich Blum - Author
"C# Network Programming" (Sybex)
http://www.sybex.com/sybexbooks.nsf/Booklist/4176
"Network Performance Open Source Toolkit" (Wiley)
http://www.wiley.com/WileyCDA/WileyT...471433012.html

Nov 15 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Rich | last post by:
Hi all, I'm trying to write an app to monitor an IIS server, by connecting and getting a page via httplib. the problem seems to be when IIS (or ASP) dies httplib does not always return and...
0
by: Nathan | last post by:
This is a copy of a message at microsoft.public.dotnet.framework.clr: THE CODE: I'm using an HttpWebResponse object to send an HTTP POST to a Java server I have written and are running on the...
3
by: Garnet2 | last post by:
I am trying to get the following code to work : HttpWebRequest request1 = (HttpWebRequest) WebRequest.Create(@"http://localhost/TacUssd/8.tac"); request1.Method = "POST"; request1.Credentials =...
2
by: JD | last post by:
Hello, I'm experiencing a problem that I'm hoping someone might be able to shed some light on. I have an ASP.NET page on a Windows 2000 machine that makes web service calls to a .NET web...
2
by: Ian Hannah | last post by:
I am running the following code (using VS 2005) with the appropriate username and password and the request always timeouts: FtpWebRequest request =...
0
by: Petri | last post by:
Hi, I'm porting my App from .NET 1.1 to .NET 2.0, and I encountered a really weird problem. I hope some of you could help... I have a function that downloads an XML file from a web server to...
1
by: ratnakarp | last post by:
Hi, I'm new to httpwebrequest programming. I'm using httpwebrequest to pull the rss file with contenttype as "GET". it works fine. I get all the results and store all the values in the list. the...
4
by: Mahernoz | last post by:
Hi Friends, I have this code in a C# console application which calls a URL on my website(Asp.net/C#) with Querystrings. (I have also tried without querystrings). The problem is my program...
4
by: Mahernoz | last post by:
Hi Friends, I have this code in a C# console application which calls a URL on my website(Asp.net/C#) with Querystrings. (I have also tried without querystrings). The problem is my program...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.