3

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
  • 3
    You should be able to test this empirically - cannot be that hard. Commented Jul 24, 2010 at 13:43

4 Answers 4

3

Without much detail, the answer is yes. testarray is a byte buffer of 100000 count. That is 100000/1024 = 97.6 KiB (damn you kB v. KiB SI standards)

Sign up to request clarification or add additional context in comments.

4 Comments

100000 bytes = 100 KB or 97,6 KiB just fyi
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 (en.wikipedia.org/wiki/Kibibyte), but I do also think it is misleading.
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.
Please don't spread this confusion. Almost nobody uses KiB. It's basically a failed idea that has only lead to great confusion
2

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.

Comments

1

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

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.