C
cyberco
Using:
Windows Mobile 5 PPC
..NetCF 2.0
I'm uploading files via the cellular connection (GPRS). This works with
files up to around 2Mb. With larger files the transfer is suddenly
aborted after around 2Mb has been uploaded. No message, nothing, not a
byte leaves the phone anymore. The only way to get out of that
situation is to reboot the device completely (by removing the battery).
I'm using the following code.
======================================================
FileStream tmpFileStream = tmpFileStream = new FileStream(appPath +
Properties.Resources.tmpUploadFile, FileMode.Open, FileAccess.Read);
HttpWebRequest req =
(HttpWebRequest)WebRequest.Create("http://bla/bla");
req.Method = "POST";
req.ContentType = "multipart/form-data; boundary=0123456789";
req.ContentLength = tmpFileStream.Length;
// Retrieve request stream and wrap in StreamWriter
Stream reqStream = req.GetRequestStream();
BinaryWriter bsw = new BinaryWriter(reqStream);
byte[] bytes = new byte[tmpFileStream.Length];
tmpFileStream.Read(bytes, 0, (int)tmpFileStream.Length);
bsw.Write(bytes);
bsw.Close();
tmpFileStream.Close();
======================================================
Does anybody here have the same experience?
What am I doing wrong?
Should I use sockets instead?
Windows Mobile 5 PPC
..NetCF 2.0
I'm uploading files via the cellular connection (GPRS). This works with
files up to around 2Mb. With larger files the transfer is suddenly
aborted after around 2Mb has been uploaded. No message, nothing, not a
byte leaves the phone anymore. The only way to get out of that
situation is to reboot the device completely (by removing the battery).
I'm using the following code.
======================================================
FileStream tmpFileStream = tmpFileStream = new FileStream(appPath +
Properties.Resources.tmpUploadFile, FileMode.Open, FileAccess.Read);
HttpWebRequest req =
(HttpWebRequest)WebRequest.Create("http://bla/bla");
req.Method = "POST";
req.ContentType = "multipart/form-data; boundary=0123456789";
req.ContentLength = tmpFileStream.Length;
// Retrieve request stream and wrap in StreamWriter
Stream reqStream = req.GetRequestStream();
BinaryWriter bsw = new BinaryWriter(reqStream);
byte[] bytes = new byte[tmpFileStream.Length];
tmpFileStream.Read(bytes, 0, (int)tmpFileStream.Length);
bsw.Write(bytes);
bsw.Close();
tmpFileStream.Close();
======================================================
Does anybody here have the same experience?
What am I doing wrong?
Should I use sockets instead?