Nooshin
Nooshin

Reputation: 178

Sending pure byte[] over wcf without any overhead

I am going to send and receive data over wcf. The application that I am working on is server, I recieve byte[] and I have to send byte[] to the client also. I don't know which applicaion or programming language they(client) are using, I just know they are excepting to recieve a byte[] without any overhead or metadata.

Is this doable with wcf? Can I somehow configure the wcf to send just byte[] without inline metadata being added to the byte[]?

I know there is another option to diretly listen to the socket and send/recieve byte[] direct from the socket but I thought wcf might be a better option.

I really appreciate any help!

Upvotes: 0

Views: 175

Answers (1)

Mimas
Mimas

Reputation: 523

If you can implement that with WCF of course, but you will have to develop lots of stuff for that. But it can be worth (IMHO), only if you are going to decode this incoming byte[] into objects on your side anyway, process deserialized data and then serialize response and send it back. To do that you will have to implement your own MessageEncoder, MessageEncoderFactory and plug it into WCF pipeline for some binding. See here one example an example.

Here is one more great sample. Actually it is worth to look on whole set of the articles about WCF extesibility.

If you need simply get bytes, process binary data and send a binary result, I would implement simple service which listen TCP port. It will be much faster to develop, and will work also much faster and fully under your control.

Upvotes: 1

Related Questions