473,395 Members | 1,919 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,395 software developers and data experts.

Code does not execute correctly on Vista Dual Core

Has anyone got HTTPWebRequest and passing a post to an authenticated site to work on a Intel Dual Core Vista Business machine.?

We expect approx. 7Kbytes but afer approx. 3K the code then hangs

My code is shown below:

Thanks all



string FormUri = "http://wwwxxxxxxxx

string FormDataString = "xxxxxxxx"

// Post Form Data

HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(FormUri);

CookieContainer cookieContainer = new CookieContainer();

req.CookieContainer = cookieContainer;

req.Method = "POST";

req.ContentType = "application/x-www-form-urlencoded";

req.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; )";

req.Headers.Add(HttpRequestHeader.AcceptLanguage, "en-GB");

req.KeepAlive = true;

HttpRequestCachePolicy policy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCac heNoStore);

req.CachePolicy = policy;

req.Accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*";

req.Headers.Add("timeperiod", DateTime.UtcNow.ToLocalTime().ToShortTimeString()) ;

ASCIIEncoding encoding = new ASCIIEncoding();

byte[] FormDataBytes = encoding.GetBytes(FormDataString);

req.ContentLength = FormDataBytes.Length;

Stream stream = req.GetRequestStream();

stream.Write(FormDataBytes, 0, FormDataBytes.Length);

stream.Close();

HttpWebResponse res = (HttpWebResponse)req.GetResponse();

Application.DoEvents();

byte[] b = new byte[1];

int i = 0;

string temp = "";

Stream Strm = res.GetResponseStream();

byte[] a = ReadFully(Strm, 32768);

string response = System.Text.Encoding.ASCII.GetString(a);.



byte[] a = ReadFully(Strm, 32768);



public byte[] ReadFully(Stream stream, int initialLength)

{

/* If we've been passed an unhelpful initial length, just

use 32K. */

if (initialLength < 1)

{

initialLength = 32768;

}

byte[] buffer = new byte[initialLength];

int read = 0;

int chunk;

while ((chunk = stream.Read(buffer, read, buffer.Length - read)) > 0) // After 2 attempts it hangs here

{

read += chunk;

/* If we've reached the end of our buffer, check to see if there's

any more information */

if (read == buffer.Length)

{

int nextByte = stream.ReadByte();

/* End of stream? If so, we're done */

if (nextByte == -1)

{

return buffer;

}

/* Nope. Resize the buffer, put in the byte we've just

read, and continue */

byte[] newBuffer = new byte[buffer.Length * 2];

Array.Copy(buffer, newBuffer, buffer.Length);

newBuffer[read] = (byte)nextByte;

buffer = newBuffer;

read++;

}

}

/* Buffer is now too big. Shrink it. */

byte[] ret = new byte[read];

Array.Copy(buffer, ret, read);

return ret;

}
Jul 24 '07 #1
0 1050

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: cwahlmeier | last post by:
Greetings, I am running DB2 Workgroup Edition on an Intel box with two physical CPUs. It is running Windows with hyperthreading. Thus, the operating system thinks it has 4 cpus. I am about to...
2
by: webwarrior | last post by:
Hi, Is there a reason why we have to pay more for licensing for a different kind of processor? Why are we not charged for the Hyperthreading on some processors also. If Oracle is really...
13
by: Pieter | last post by:
Hi, Maybe a little bit off-topic, but it still seemd the best place to ask for it :-) I'm planning to buy a new development laptop, and I would like to buy an AMD, Dual Core,-bit But none of...
13
by: Mark Rae | last post by:
Hi, On Friday I attended the Microsoft EVO conference in London where they talked about Vista, Office 2007 and Exchange 2007 and how they all work together beautifully, how they were all...
6
by: Mark Rae | last post by:
http://www.microsoft.com/downloads/details.aspx?FamilyID=90e2942d-3ad1-4873-a2ee-4acc0aace5b6&DisplayLang=en As I understand it, VS.NET 2005 + SP1 + this patch is the first version of VS.NET on...
8
by: Andy | last post by:
Hi guys, I'm sorry, I'm not sure this is the correct group to be asking this kind of question... I'm going to develop a software package that includes a web server (and PHP code) , a...
8
by: chu2ch | last post by:
Good Day Folks, We have an .net 2.0 application that has been working reasonably well in windows xp, we have installed our application on windows vista business and have noticed a significant...
3
by: Paul Sijben | last post by:
I am running a multi-threaded python application in a dual core intel running Ubuntu. I am using python 2.5.1 that I compiled myself. At random points I am getting segmentation faults (sometimes...
10
by: Arno R | last post by:
Hi all, So I bought a new laptop 10 days ago to test my apps with Vista. (home premium) Apparently Office 2007 is pre-installed. (a time limited but complete test version, no SP1) So I take the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.