System.Runtime.Remoting.Channels.BinaryServerFormatterSink Class

Assembly: System.Runtime.Remoting.dll
Namespace: System.Runtime.Remoting.Channels
Summary
Provides the implementation for a server formatter sink that uses the BinaryFormatter.
C# Syntax:
public class BinaryServerFormatterSink : IServerChannelSink, IChannelSinkBase
Remarks
The request stream propagates from the server transport sink through the server channel sinks until it reaches the appropriate formatter sink. The formatter sink deserializes the message and passes it through the pipeline. A special dispatch sink is inserted at the end of the channel sink chain by the ChannelServices.CreateServerChannelSinkChain method, which is called by server channels to create the server channel sink chains. When the message reaches the dispatch sink, the dispatch sink passes the message to the remoting infrastructure.
See also:
System.Runtime.Remoting.Channels Namespace See also:
MSDN: sinkssinkchains | BinaryServerFormatterSinkProvider

System.Runtime.Remoting.Channels.BinaryServerFormatterSink Member List:

Public Constructors
ctor #1 Initializes a new instance of the BinaryServerFormatterSink class.
Public Properties
NextChannelSink Read-only

Gets the next IServerChannelSink in the sink chain.
Properties Read-only

Gets an IDictionary of properties for the current channel sink.
Public Methods
AsyncProcessResponse Requests processing of the response from a method call sent asynchronously.
Equals
(inherited from System.Object)
See base class member description: System.Object.Equals

Derived from System.Object, the primary base class for all objects.
GetHashCode
(inherited from System.Object)
See base class member description: System.Object.GetHashCode

Derived from System.Object, the primary base class for all objects.
GetResponseStream Returns the Stream onto which the provided response message is to be serialized.
GetType
(inherited from System.Object)
See base class member description: System.Object.GetType

Derived from System.Object, the primary base class for all objects.
ProcessMessage Requests message processing from the current sink.
ToString
(inherited from System.Object)
See base class member description: System.Object.ToString

Derived from System.Object, the primary base class for all objects.
Protected Methods
Finalize
(inherited from System.Object)
See base class member description: System.Object.Finalize

Derived from System.Object, the primary base class for all objects.
MemberwiseClone
(inherited from System.Object)
See base class member description: System.Object.MemberwiseClone

Derived from System.Object, the primary base class for all objects.

Hierarchy:


System.Runtime.Remoting.Channels.BinaryServerFormatterSink Member Details

ctor #1
Summary
Initializes a new instance of the BinaryServerFormatterSink class.
C# Syntax:
public BinaryServerFormatterSink(BinaryServerFormatterSink(
   BinaryServerFormatterSink.Protocol protocol,
   IServerChannelSink nextSink,
   IChannelReceiver receiver
);
Parameters:

protocol

The BinaryServerFormatterSink.Protocol that will be used with the current instance of BinaryServerFormatterSink.

nextSink

The next sink in the channel sink chain.

receiver

Indicates the channel that will receive the messages serialized by the new instance of BinaryServerFormatterSink.

Return to top


Property: NextChannelSink (read-only)
Summary
Gets the next IServerChannelSink in the sink chain.
C# Syntax:
public IServerChannelSink NextChannelSink {get;}
Implements:
IServerChannelSink.NextChannelSink

Return to top


Property: Properties (read-only)
Summary
Gets an IDictionary of properties for the current channel sink.
C# Syntax:
public IDictionary Properties {get;}
Implements:
IChannelSinkBase.Properties
Remarks


Note For more information, see the conceptual topic at MSDN: channelformatterconfigurationproperties.
See also:
MSDN: channelformatterconfigurationproperties

Return to top


Method: AsyncProcessResponse(
   IServerResponseChannelSinkStack sinkStack,
   object state,
   IMessage msg,
   ITransportHeaders headers,
   Stream stream
)
Summary
Requests processing of the response from a method call sent asynchronously.
C# Syntax:
public void AsyncProcessResponse(
   IServerResponseChannelSinkStack sinkStack,
   object state,
   IMessage msg,
   ITransportHeaders headers,
   Stream stream
);
Parameters:

sinkStack

A stack of sinks leading back to the server transport sink.

state

Information associated with the current sink, generated on the request side, and needed on the response side.

msg

The response message.

headers

The headers to add to the return message heading to the client.

stream

The stream heading back to the transport sink.

Implements:
IServerChannelSink.AsyncProcessResponse
See also:
ServerChannelSinkStack | ServerChannelSinkStack.Push | MSDN: sinkssinkchains

Return to top


Method: Equals(
   object obj
)
Inherited
See base class member description: System.Object.Equals
C# Syntax:
public virtual bool Equals(
   object obj
);

For more information on members inherited from System.Object click on the link above.

Return to top


Method: Finalize()
Inherited
See base class member description: System.Object.Finalize
C# Syntax:
~BinaryServerFormatterSink();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GetHashCode()
Inherited
See base class member description: System.Object.GetHashCode
C# Syntax:
public virtual int GetHashCode();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GetResponseStream(
   IServerResponseChannelSinkStack sinkStack,
   object state,
   IMessage msg,
   ITransportHeaders headers
)
Summary
Returns the Stream onto which the provided response message is to be serialized.
C# Syntax:
public Stream GetResponseStream(
   IServerResponseChannelSinkStack sinkStack,
   object state,
   IMessage msg,
   ITransportHeaders headers
);
Parameters:

sinkStack

A stack of sinks leading back to the server transport sink.

state

Information associated with the current sink, generated on the request side, and needed on the response side.

msg

The response message to serialize.

headers

The headers to put in the response stream to the client.

Return Value:
The Stream onto which the provided response message is to be serialized.
Implements:
IServerChannelSink.GetResponseStream
Remarks
This method is called when a response stream needs to be created.
See also:
MSDN: sinkssinkchains

Return to top


Method: GetType()
Inherited
See base class member description: System.Object.GetType
C# Syntax:
public Type GetType();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: MemberwiseClone()
Inherited
See base class member description: System.Object.MemberwiseClone
C# Syntax:
protected object MemberwiseClone();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: ProcessMessage(
   IServerChannelSinkStack sinkStack,
   IMessage requestMsg,
   ITransportHeaders requestHeaders,
   Stream requestStream,
   out IMessage responseMsg,
   out ITransportHeaders responseHeaders,
   out Stream responseStream
)
Summary
Requests message processing from the current sink.
C# Syntax:
public ServerProcessing ProcessMessage(
   IServerChannelSinkStack sinkStack,
   IMessage requestMsg,
   ITransportHeaders requestHeaders,
   Stream requestStream,
   out IMessage responseMsg,
   out ITransportHeaders responseHeaders,
   out Stream responseStream
);
Parameters:

sinkStack

A stack of channel sinks that called the current sink.

requestMsg

The message that contains the request.

requestHeaders

Headers retrieved from the incoming message from the client.

requestStream

The stream that needs to be processed and passed on to the deserialization sink.

responseMsg

When this method returns, contains an IMessage that holds the response message. This parameter is passed uninitialized.

responseHeaders

When this method returns, contains an ITransportHeaders that holds the headers to add to return message heading to the client. This parameter is passed uninitialized.

responseStream

When this method returns, contains a Stream that is heading to the transport sink. This parameter is passed uninitialized.

Return Value:
A ServerProcessing status value that provides information about how the message was processed.
Implements:
IServerChannelSink.ProcessMessage
Remarks
The proxy's job is to convert a method call invoked on it into a message. The message, which implements the IMessage interface, is passed from the client end to the server end by invoking IServerChannelSink.ProcessMessage on message sink objects. Message sinks are chained together, which means that every message sink is responsible for calling IServerChannelSink.ProcessMessage on the next message sink after the current message sink has finished its work. For instance, a synchronization-related message sink might cause a lock to be acquired or released and delegated to the downstream message sink.

When the formatter channel sink gets a message that needs to be sent over the channel, it calls IMessageSink.SyncProcessMessage, passing the message as a parameter. The formatter sink then creates the transport header array and calls IClientChannelSink.GetRequestStream on the formatter sink. This call is forwarded down the sink chain, and any sink can create a request stream that will be passed back to the formatter sink. After this call returns, the message is serialized, IClientChannelSink.ProcessMessage is called on the first chain in the sink chain, and the message is passed to the channel sinks.

After the channel sinks get the message, they can write data to the stream, add headers to the header array, and add themselves to the sink stack before forwarding the call to the next sink. When the call reaches the transport sink at the end of the chain, the transport sink sends the headers and serialized message over the channel to the server, where the process is reversed.

When the message gets to the server side, the transport sink retrieves the headers and serialized message from the stream and forwards these through the sink chain until the formatter sink is reached. The formatter sink then deserializes the message and forwards it to the remoting infrastructure. Then, the remoting infrastructure turns the message into a method call, and calls the server object.

Return to top


Method: ToString()
Inherited
See base class member description: System.Object.ToString
C# Syntax:
public virtual string ToString();

For more information on members inherited from System.Object click on the link above.

Return to top


Top of page

Copyright (c) 2002 Microsoft Corporation. All rights reserved.