-1

Compact Framework Language: C # FrameWork 3.5

I have a client (pocket PC) and I want to send data to web service REST (https connection). I need to upload large files of several megabytes and then I have multiple connections by dividing the file into chunks. I do:

 byte[] formData = new byte[...];
 formDataStream.Read(formData, 0, (int) formDataStream.Length);

There is a parameter in the compact framework that tells me what is the maximum size that I can allocate in formData according to the device in use? If yes, what library could I use to get this parameter? In this way I could split the file in chunks of default size.

user2075861
  • 117
  • 2
  • 15

1 Answers1

1

There is no library that can tell you what the largest array you can allocate is because that number is not fixed. It depends on the available memory and heap fragmentation on the device at the exact time you want to make the allocation. Your best bet is to just pick a reasonable size based on your typical device state, I'd probably pick 64k, and then try "tuning" it from there to see what gives you the best performance.

ctacke
  • 66,480
  • 18
  • 94
  • 155
  • Thank you ctacke...But, for example, if I have a 5MB file to upload, with 64Kb chunks I'll have a lot of connections...And since the application should run in various pocket pc, I'm not able to know the heap situation in advance. Any other advices? – user2075861 Feb 15 '13 at 15:23
  • What says you have to have all of the connections open at once? You could easily set a max connection count. Also, these devices have single core processors and single networking chips with a single system bus. I'm willing to bet that you'll find that 1 connection gives the same performance as 10. – ctacke Feb 15 '13 at 15:32