D
Detlev Schwabe
Hello,
the following code excerpt throws a Timeout web exception IF:
a) the POST goes over an HTTPS connection, and
b) the POST content (the byte array) is of a certain size (probably a few
kilobytes)
Shorter content (<1024bytes) works fine and reach the server. But an array
of 30KB or larger never reach the server. The strange thing is that
everything works like expected if the connection is an ordinary HTTP.
No matter how large I set the timeout time, or whatever combination I choose
for ContentLength, AllowWriteStreamBuffering or SendChunked, it always fails
for byte arrays that are larger than a couple hundred bytes.
I'm using CF 2.0 on a Pocket PC 2003 2nd Ed. device. The script on the
server is a ASP.NET handler. The proper certificates for SSL have all been
installed on the device.
Anyone any ideas?
Any help is greatly appreciated!
-Detlev
-----------------------------------------------------------
private bool PostStream( byte[] buffer, string url )
{
Uri myUri = new Uri( url );
HttpWebRequest objRequest = ( HttpWebRequest )WebRequest.Create( myUri );
objRequest.Method = "POST";
objRequest.ContentType = "application/octet-stream";
objRequest.ContentLength = buffer.Length;
objRequest.AllowWriteStreamBuffering = true;
try
{
using( BinaryWriter wr = new BinaryWriter(
objRequest.GetRequestStream() ) )
{
wr.Write( buffer, 0, buffer.Length );
wr.Close();
}
}
catch( Exception )
{
return false;
}
try
{
HttpWebResponse objResponse = ( HttpWebResponse )objRequest.GetResponse();
using( StreamReader sr = new StreamReader(
objResponse.GetResponseStream() ) )
{
//...
}
}
catch( WebException )
{
// the timeout is caught here...
return false;
}
}
the following code excerpt throws a Timeout web exception IF:
a) the POST goes over an HTTPS connection, and
b) the POST content (the byte array) is of a certain size (probably a few
kilobytes)
Shorter content (<1024bytes) works fine and reach the server. But an array
of 30KB or larger never reach the server. The strange thing is that
everything works like expected if the connection is an ordinary HTTP.
No matter how large I set the timeout time, or whatever combination I choose
for ContentLength, AllowWriteStreamBuffering or SendChunked, it always fails
for byte arrays that are larger than a couple hundred bytes.
I'm using CF 2.0 on a Pocket PC 2003 2nd Ed. device. The script on the
server is a ASP.NET handler. The proper certificates for SSL have all been
installed on the device.
Anyone any ideas?
Any help is greatly appreciated!
-Detlev
-----------------------------------------------------------
private bool PostStream( byte[] buffer, string url )
{
Uri myUri = new Uri( url );
HttpWebRequest objRequest = ( HttpWebRequest )WebRequest.Create( myUri );
objRequest.Method = "POST";
objRequest.ContentType = "application/octet-stream";
objRequest.ContentLength = buffer.Length;
objRequest.AllowWriteStreamBuffering = true;
try
{
using( BinaryWriter wr = new BinaryWriter(
objRequest.GetRequestStream() ) )
{
wr.Write( buffer, 0, buffer.Length );
wr.Close();
}
}
catch( Exception )
{
return false;
}
try
{
HttpWebResponse objResponse = ( HttpWebResponse )objRequest.GetResponse();
using( StreamReader sr = new StreamReader(
objResponse.GetResponseStream() ) )
{
//...
}
}
catch( WebException )
{
// the timeout is caught here...
return false;
}
}