tags:

views:

495

answers:

1

Hello gurus,

I have a desktop application sending/receiving messages (not files) to/from a WCF service.

How do I intercept the total size of the message to be transferred and receive feedback (number of bytes transferred) during the transmission so a progress bar maybe displayed to the desktop app user?

How many approaches are there? What is the best one given my application scenario?

Any comments or suggestions will be greatly appreciated,

Cullen

+2  A: 

You'll need to check out the extensibility points of WCF in order to hook into the process of message being sent back and forth.

You could e.g. implement a IClientMessageInspector to inspect the message just before it is sent out to the server, and possibly also the response as it comes back. See the MSDN docs for a starting point.

This might also be a good starting point - a white paper on the basics of WCF Extensibility.

This gentlemen here shows how to Write a WCF message inspector - exactly what you'd be looking at.

I doubt you'll be able to hook into a "so many bytes have been transferred so far" kind of feedback loop, though - plus, if your messages are of reasonable size, sending them onto the wire will be a matter of microseconds and updating your progress bar would take longer than sending them :-)

Marc

marc_s
@mark_s: thanks, I'll check out the various resources you've included in your post.
Cullen Tsering