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

I am at my wits end! httpwebresponse stream to byte array

2
VB NET 2005

I would be ecstatic if some kind soul could solve this for me. Without the extraneous stuff note the following code:

Expand|Select|Wrap|Line Numbers
  1. Dim res() as byte
  2. .
  3. .
  4. Dim WR As HttpWebResponse = HR.GetResponse
  5. .
  6. .
  7. Dim WRCL As Long = WR.ContentLength
  8.  
  9. ReDim res(WRCL - 1)
  10.  
  11. GetResponseStream.Read(res, 0, WRCL)
  12.  
This does not cause any errors but I end up with corrupt data in 'res'. HOWEVER if I recode it such that I only get 1 or 2 bytes at a time then it works but it seems so darn inefficient to have to loop around thousands of times especially when the data is over 100k bytes.

I know the number of bytes to read and remember it works just fine reading one at a time into the array so WHY oh WHY won't it work if I try to read the whole lot at once???
Aug 10 '07 #1
2 3248
ybop
2
I guess based on the zero responses, not many httpwebresponse experts here. Thanks for reading anyway.

VB NET 2005

I would be ecstatic if some kind soul could solve this for me. Without the extraneous stuff note the following code:

Expand|Select|Wrap|Line Numbers
  1. Dim res() as byte
  2. .
  3. .
  4. Dim WR As HttpWebResponse = HR.GetResponse
  5. .
  6. .
  7. Dim WRCL As Long = WR.ContentLength
  8.  
  9. ReDim res(WRCL - 1)
  10.  
  11. GetResponseStream.Read(res, 0, WRCL)
  12.  
This does not cause any errors but I end up with corrupt data in 'res'. HOWEVER if I recode it such that I only get 1 or 2 bytes at a time then it works but it seems so darn inefficient to have to loop around thousands of times especially when the data is over 100k bytes.

I know the number of bytes to read and remember it works just fine reading one at a time into the array so WHY oh WHY won't it work if I try to read the whole lot at once???
Aug 12 '07 #2
Killer42
8,435 Expert 8TB
I guess based on the zero responses, not many httpwebresponse experts here. Thanks for reading anyway.
Sorry to see you didn't get any answers here. (Don't forget with the weekend, you may have missed a lot of members).

It might be worth asking in the .Net forum, as well. I suspect a lot of people who use VB.Net (any version later than the ten-year-old VB6) tend to hang around there more than here.
Aug 13 '07 #3

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

Similar topics

2
by: Nat | last post by:
Hi there, I have code as following but it returns error Error Type: Microsoft VBScript compilation (0x800A03F6) Expected 'End' /urbisjhdintranet/metadata/resultList.asp, line 324 which is the...
5
by: WindAndWaves | last post by:
Hi Team The function below searches all the tables in a database. However, if subsearch = true then it searches all the objects listed in a recordset (which are all table names). I thought to...
1
by: Brian | last post by:
Hello all. Hope you're all enjoying your Christmas / New Years etc. I know i've asked this before but i am truly at my wit's end, so any help right now would be much appreciated! How do i...
8
by: Howard Kaikow | last post by:
I got bored today, so I decided to rewrite the code in KB article 316383 to decrease the number of object references. This resulted in a number of nested With ... End With. The original code had...
11
by: Steve Jorgensen | last post by:
I'm working on an application in Access 2002, and every time I'm done making changes in the VBA project, the database is noticeably larger after compacting, even when code changes are small or even...
8
by: rdemyan via AccessMonster.com | last post by:
Anyone have any ideas on how to determine when the back-end file (containing only tables) has been updated with new data. The date/time of the file won't work because it gets updated to the...
5
by: The alMIGHTY N | last post by:
Hi all, Let's say I have a simple math formula: sum (x * y / 1000) / (sum z / 1000) I have to do this across 50 items, each with an x, y and z value, when the page first loads AND when a...
3
by: bbcworldtour | last post by:
(SQL Server 2005, express edition) I have a list of table names that I need to translate according to a naming convention. I'm doing this using pattern matching in a LIKE clause. In one...
10
kcdoell
by: kcdoell | last post by:
Good Morning: I have 12 and 3 . I created the below query: SELECT , , Sum() AS , Sum() AS FROM UqryProductTypeStatic WHERE ((()=..-1) AND (()=..)) GROUP BY , ;
0
by: xkenneth | last post by:
All, If anyone has any interest in developing a bit of code for generating WITS and WITSML in python, then drop me a line. I've started a project on google apps, "PyWITS", and I plan to support...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
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.