In our last post Channel shapes and Communication Patterns we saw how channels are used to transform message from client to server and vice versa.
Today we will see Channel Objects and how they work .
There are three categories of channel objects
2) Channel Listeners (Responsible for server side communication)
3) Channel Factory ((Responsible for client side communication))
1) Channels work as interface between the application and Channel Stack For more on channel stack see Channels and Channel Stack.
2) Channel listeners form the base for server side communication.
* They are responsible for listening for incoming messages, creating channel
stacks, and providing a reference to the top of the stack to applications
* It is responsible for creating channel stack at receiver end.
* They receive messages from either the transport channel or the channel below in
the channel stack
Note - Most developers will not work with channel listeners directly. They will use the ServiceHost class to host services, which uses a channel listener to listen for messages
3) Channel Factory
* A channel factory creates a channel for sending messages and maintains
ownership of the channels it creates.
* These channels are responsible for getting the message from the layer above, performing whatever processing is necessary, then sending the message to the layer below.
Note - Most developers will never use a channel factory directly. Instead, they will use a class derived from ClientBase<> which is typically generated from svcutil.exe or Add Service Reference in Visual Studio.
Difference between channel listeners and channel factories
channel factories are responsible for closing down all associated channels;channel listeners are not.
This distinction was made so that channel listeners could be shut down independent of their channels.
Hope this will help you.