tags:

views:

84

answers:

4

Does the byte[] array size reflects the same size of bytes to be transmitted if I need to transmit the file via a webservice?

E.G:

byte[] testarray = new byte[100000]

means that its size if transmitted will be approx 100,000 bytes (100kB)?

thanks

+1  A: 

Yes, that is as long as you don't encode it differently.

Eiko
A: 

Without much detail, the answer is yes. testarray is a byte buffer of 100000 count. That is 100000/1024 = 97.6 kB

jalexiou
100000 bytes = 100 KB or 97,6 KiBjust fyi
cevik
Every since the HD manufacturers decided that 1000 bytes is a kilobyte (for marketing reasons) they screwed everybody else who for years have counted bits, bytes, kilobytes, megabytes, etc .. the proper way. I understand the IEC standard (http://en.wikipedia.org/wiki/Kibibyte), but I do also think it is misleading.
jalexiou
Do we also need to rename the old Commodore 64 into the 65, since it is RAM is 65.5 kB instead of 64 KiB.
jalexiou
Please don't spread this confusion. Almost nobody uses KiB. It's basically a failed idea that has only lead to great confusion
John Burton
+2  A: 

It depends what protocol you will be using for accessing the web service. If you're using SOAP over HTTP, there is going to be significant overhead, because the byte array will be transmitted as a base64 string. That would still mean an roughly a 8/6 increase in size, just over 130 kiB.

You may want to look into using MTOM. That will significantly reduce the overhead.

Another thing you may need to consider is that web service frameworks such as WCF sometimes have maximum message sizes. For the default WCF configuration, the message would be too large.

Thorarin
A: 

Usually no, because all data has to be serialised into the appropriate format dictated by the binding or protocol that the service is using.

Different service technologies use different serialisers, WCF in particular is highly configurable. Your array could be transmitted as an XML fragment with one element per array element, a JSON string, old-style SOAP RPC format, base64 string, or whatever.

Christian Hayter