|
-
Jul 27th, 2005, 09:08 PM
#1
Thread Starter
PowerPoster
dynamically expand byte?
is there a way to dynamically expand a byte[]?
The user will have no idea how big or small the data will be incoming from the server so in order to read the incoming data to the byte[] - you kinda need to know the exact size in order to grab the entire information...
Thanks
-
Jul 27th, 2005, 09:15 PM
#2
Re: dynamically expand byte?
you cant resize an array. You could declare a new one with a new size but then you'd have to copy all the content of the old array to it 
a byte list in .NET 2.0 would be nicer I guess (it'd be like an arraylist)
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Jul 27th, 2005, 09:57 PM
#3
Thread Starter
PowerPoster
Re: dynamically expand byte?
wish I could work with .NET 2.0 but unfortunatly cannot.
drats. So what way is there to recieve data of any size? as I understand when trying to read from a NetworkStream it has to be read into a byte[]
-
Jul 27th, 2005, 10:10 PM
#4
Re: dynamically expand byte?
I'm not 100% sure this would work but intuitively I would suggest you read the stream in chunks of a known size into a byte array and then you could call AddRange to add those bytes to an ArrayList. If you need a single array at the end then call ToArray on the ArrayList.
-
Jul 27th, 2005, 10:14 PM
#5
Thread Starter
PowerPoster
Re: dynamically expand byte?
interesting. I will try that.
whilst i am here this is what i am trying to do:
the client requests a list of files. the server gets these lists of files and for each file there is, it actually sends that filename to the client
the client recieves it however it for some reasons recieves it in one big long string... instead of just the short outbursts from the server....
this is why i was asking about how to dynamically increase the byte array... because I cannot for the life of me figure out why the client is recieving it as a big string.
so frustrating...
wierd thing is, if the client and server talk to each other (like an IM program) they recieve the text as they should....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|