mouthpiec
mouthpiec

Reputation: 4033

Best way / Fasters way to transfer an image via webservice

what is the best way to transfer an 800*600 image via a webservice using C#?

I am looking for a fast method.

thanks

Upvotes: 0

Views: 1509

Answers (4)

Dr. Wily's Apprentice
Dr. Wily's Apprentice

Reputation: 10280

If you're using WSE, consider using MTOM.

If you're using WCF, you could use an MTOM binding.

Upvotes: 1

Jacob Ewald
Jacob Ewald

Reputation: 2178

You'll probably want to send the image in small pieces (even if it's zipped up as Chris Schroeder mentioned), say 50K at a time. This gives you two advantages over sending the entire file at once:

  • You can show progress to the user
  • If one piece fails to transmit then you only have to send that piece rather than the whole file

However, with this method is you now have 2 new problems to handle and that is making sure you get ALL of the pieces, and that they're in the correct order.

Sending some metadata with the image data can fix this situation. An identifier that relates this piece of data with the others, and the piece number which will determine where this piece should be in relation to the rest of the pieces.

Upvotes: 0

Stécy
Stécy

Reputation: 12357

If you are using WCF 4.0 then you could use socket programming and from there you could transmit as binary (compressed with 7zip of course).

If the image is already in a compressed format (jpeg for example) then compression would not be that great and it would slow down the actual total transfer (compress - transmit - decompress).

Upvotes: 1

Kristoffer Schroeder
Kristoffer Schroeder

Reputation: 688

If you want to save bandwidth/Speed (Not tested on many different image formats)

7zip C# SDK (http://www.7-zip.org/sdk.html) 7-Zip the bytes and send the bytes

and where needed un"7-Zip" (LZMA) the bytes and convert to image.

Upvotes: 0

Related Questions