IDuplexSession.CloseOutputSession Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Terminates the outbound session that indicates that no more messages will be sent from this endpoint on the channel associated with the session.
Overloads
CloseOutputSession() |
Terminates the outbound session that indicates that no more messages will be sent from this endpoint on the channel associated with the session. |
CloseOutputSession(TimeSpan) |
Terminates the outbound session that indicates that no more messages will be sent from this endpoint on the channel associated with the session within a specified interval of time. |
CloseOutputSession()
- Source:
- IDuplexSession.cs
- Source:
- IDuplexSession.cs
Terminates the outbound session that indicates that no more messages will be sent from this endpoint on the channel associated with the session.
public:
void CloseOutputSession();
public void CloseOutputSession ();
abstract member CloseOutputSession : unit -> unit
Public Sub CloseOutputSession ()
Remarks
Calling CloseOutputSession() signals to the other side of the session that it should return null
from any outstanding or subsequent calls made to Receive. CloseOutputSession is idempotent, so calling it again has no effect.
Terminating the outbound session does not affect the incoming session and so makes no statement about the ability to receive messages on the session associated with the input channel.
Notes to Implementers
CloseOutputSession() is a session method that can interact with the IDuplexSessionChannel that owns the session. In particular, if your session lifetime is put together with your channel lifetime (like it is with TCP and reliable session and security):
If CloseOutputSession() is called before Close() is called on the channel, Close() should wait for CloseOutputSession() to finish.
If the channel is in the Created or Opening state, CloseOutputSession() should throw an InvalidOperationException.
If the channel is in the Faulted state, CloseOutputSession() should throw a CommunicationObjectFaultedException.
The channel should fault if CloseOutputSession() throws.
The implementation of Close() on the channel should call CloseOutputSession() and then verify that Receive() returns
null
, which indicates that CloseOutputSession() was called from the other side of the session.
Applies to
CloseOutputSession(TimeSpan)
- Source:
- IDuplexSession.cs
- Source:
- IDuplexSession.cs
Terminates the outbound session that indicates that no more messages will be sent from this endpoint on the channel associated with the session within a specified interval of time.
public:
void CloseOutputSession(TimeSpan timeout);
public void CloseOutputSession (TimeSpan timeout);
abstract member CloseOutputSession : TimeSpan -> unit
Public Sub CloseOutputSession (timeout As TimeSpan)
Parameters
- timeout
- TimeSpan
The TimeSpan that specifies the interval of time within which the operation must complete.
Remarks
Calling CloseOutputSession(TimeSpan) signals to the other side of the session that it should return null
from any outstanding or subsequent calls made to Receive. CloseOutputSession is idempotent, so calling it again has no effect.
Terminating the outbound session does not affect the incoming session and so makes no statement about the ability to receive messages on the session associated with the input channel.
Notes to Implementers
CloseOutputSession() is a session method that can interact with the IDuplexSessionChannel that owns the session. In particular, if your session lifetime is put together with your channel lifetime (like it is with TCP and reliable session and security):
If CloseOutputSession() is called before Close() is called on the channel, Close() should wait for CloseOutputSession() to finish.
If the channel is in the Created or Opening state, CloseOutputSession() should throw an InvalidOperationException.
If the channel is in the Faulted state, CloseOutputSession() should throw a CommunicationObjectFaultedException.
The channel should fault if CloseOutputSession() throws.
The implementation of Close() on the channel should call CloseOutputSession() and then verify that Receive() returns
null
, indicating that CloseOutputSession() was called from the other side of the session.