IChannelSender.CreateMessageSink メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > IChannelSender.CreateMessageSink メソッドの意味・解説 

IChannelSender.CreateMessageSink メソッド

指定した URL またはチャネル データ オブジェクトにメッセージを配信するチャネル メッセージ シンクを返します。

名前空間: System.Runtime.Remoting.Channels
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Function CreateMessageSink ( _
    url As String, _
    remoteChannelData As Object, _
    <OutAttribute> ByRef objectURI As
 String _
) As IMessageSink
Dim instance As IChannelSender
Dim url As String
Dim remoteChannelData As Object
Dim objectURI As String
Dim returnValue As IMessageSink

returnValue = instance.CreateMessageSink(url, remoteChannelData, objectURI)
IMessageSink CreateMessageSink (
    string url,
    Object remoteChannelData,
    out string objectURI
)
IMessageSink^ CreateMessageSink (
    String^ url, 
    Object^ remoteChannelData, 
    [OutAttribute] String^% objectURI
)
IMessageSink CreateMessageSink (
    String url, 
    Object remoteChannelData, 
    /** @attribute OutAttribute() */ /** @ref */ String objectURI
)
JScript では、値型の引数は参照渡しされません。

パラメータ

url

新しいシンクがメッセージを配信する先の URL。null 参照 (Visual Basic では Nothing) でもかまいません。

remoteChannelData

新しいシンクがメッセージを配信する先のリモート ホストのチャネル データ オブジェクト。null 参照 (Visual Basic では Nothing) でもかまいません。

objectURI

このメソッドが返されるときに、指定した URL またはチャネル データ オブジェクトにメッセージを配信する新しいチャネル メッセージ シンクの URI を格納します。このパラメータは初期化せずに渡されます。

戻り値
指定した URL またはチャネル データ オブジェクトにメッセージを配信するチャネル メッセージ シンク。指定したエンドポイントにチャネルを接続できない場合は null 参照 (Visual Basic では Nothing)。

例外例外
解説解説

CreateMessageSink メソッドは、指定した URL またはチャネル データ オブジェクトにメッセージを配信するチャネル メッセージ シンクを返します。uri パラメータが null 参照 (Visual Basic では Nothing) の場合は、シンクの対象として remoteChannelData パラメータが使用されます。url パラメータまたは remoteChannelData パラメータのいずれかを null 参照 (Visual Basic では Nothing) にすることはできますが、両方を null にすることはできません。

使用例使用例
Imports System
Imports System.Collections
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting.Messaging
Imports System.Runtime.Remoting.Channels.Http
Imports System.Security.Permissions

Public Class MyClient
   <PermissionSet(SecurityAction.LinkDemand)> _
   Public Shared Sub Main()
      Try
         ' Create the 'IDictionary' to set the server object properties.
         Dim myDictionary As New
 Hashtable()
         myDictionary("name") = "HttpClientChannel"
         myDictionary("priority") = 2
         ' Set the properties along with the constructor.
         Dim myIChannelSender As New
 HttpClientChannel(myDictionary, _
                 New BinaryClientFormatterSinkProvider())
         ' Register the server channel.
         ChannelServices.RegisterChannel(myIChannelSender)
         Dim myHelloServer1 As MyHelloServer
 = CType(Activator.GetObject(GetType(MyHelloServer), _
                 "http://localhost:8085/SayHello"),
 MyHelloServer)
         If myHelloServer1 Is Nothing
 Then
            Console.WriteLine("Could not locate server")
         Else
            Console.WriteLine(myHelloServer1.myHelloMethod("Client"))
            ' Get the name of the channel.
            Console.WriteLine("Channel Name :" + myIChannelSender.ChannelName)
            ' Get the channel priority.
            Console.WriteLine("ChannelPriority :"
 + myIChannelSender.ChannelPriority.ToString())
            Dim myString As String
 = ""
            Dim myObjectURI1 As String
 = ""
            Console.WriteLine("Parse :" + myIChannelSender.Parse("http://localhost:8085/SayHello",
 _
                 myString) + myString)
            ' Get the channel message sink that delivers message to
 specified url.
            Dim myIMessageSink As IMessageSink
 = _
                 myIChannelSender.CreateMessageSink("http://localhost:8085/NewEndPoint",
 _
                 Nothing, myObjectURI1)
            Console.WriteLine("Channel message sink used :"
 + CType(myIMessageSink,Object).ToString())
            Console.WriteLine("URI of new channel message sink
 :" + myObjectURI1)
         End If
      Catch ex As Exception
         Console.WriteLine("Following exception is raised on client
 side : " + ex.Message)
      End Try
   End Sub 'Main
End Class 'MyClient
using System;
using System.Collections;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Messaging;
using System.Runtime.Remoting.Channels.Http;
using System.Security.Permissions;

public class MyClient
{
   [PermissionSet(SecurityAction.LinkDemand)]
   public static void Main()
   {
      try
      {
         // Create the 'IDictionary' to set the server object properties.
         IDictionary myDictionary = new Hashtable();
         myDictionary["name"] = "HttpClientChannel";
         myDictionary["priority"] = 2;
         // Set the properties along with the constructor.
         IChannelSender myIChannelSender = new HttpClientChannel(myDictionary
,
                                    new BinaryClientFormatterSinkProvider());
         // Register the server channel.
         ChannelServices.RegisterChannel(myIChannelSender);
         MyHelloServer myHelloServer1 = (MyHelloServer)Activator.GetObject(
                  typeof(MyHelloServer), "http://localhost:8085/SayHello");
         if (myHelloServer1 == null)
         {
            Console.WriteLine("Could not locate server");
         }
         else
         {
            Console.WriteLine(myHelloServer1.myHelloMethod("Client"));
            // Get the name of the channel.
            Console.WriteLine("Channel Name :" + myIChannelSender.ChannelName);
            // Get the channel priority.
            Console.WriteLine("ChannelPriority :" + 
                        myIChannelSender.ChannelPriority.ToString());
            string myString,myObjectURI1;
            Console.WriteLine("Parse :" + 
                myIChannelSender.Parse("http://localhost:8085/SayHello",out
 myString)
                + myString);
            // Get the channel message sink that delivers message to
 specified url.
            IMessageSink myIMessageSink = 
                  myIChannelSender.CreateMessageSink(
                  "http://localhost:8085/NewEndPoint", null,out
 myObjectURI1);
            Console.WriteLine("Channel message sink used :" + myIMessageSink.ToString());
            Console.WriteLine("URI of new channel message
 sink :" + myObjectURI1);
         }
      }
      catch(Exception ex)
      {
         Console.WriteLine("Following exception is raised on client side : "
 + ex.Message);
      }
   }
}
.NET Framework のセキュリティ.NET Framework のセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
IChannelSender インターフェイス
IChannelSender メンバ
System.Runtime.Remoting.Channels 名前空間



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

IChannelSender.CreateMessageSink メソッドのお隣キーワード

   

英語⇒日本語
日本語⇒英語
   



IChannelSender.CreateMessageSink メソッドのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS