Skip to content

Instantly share code, notes, and snippets.

@noqisofon
Created November 19, 2010 07:30
Show Gist options
  • Save noqisofon/706227 to your computer and use it in GitHub Desktop.
Save noqisofon/706227 to your computer and use it in GitHub Desktop.
リモート用クライアントフォーム。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Ipc;
using System.Windows.Forms;
namespace demo.ipc.remoting.app.widgets {
using demo.ipc.util;
/// <summary>
///
/// </summary>
public partial class IPCRemotingClientForm : Form {
/// <summary>
///
/// </summary>
public IPCRemotingClientForm() {
InitializeComponent();
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="ergs"></param>
private void IPCRemotingClientForm_Load(object sender, EventArgs ergs) {
// IPC チャンネルを作成します。
this.server_channel_ = new IpcServerChannel( "remote" );
// チャンネルを登録します。
ChannelServices.RegisterChannel( this.server_channel_, true );
// リモートオブジェクトの型を登録します。
RemotingConfiguration.RegisterWellKnownClientType( typeof( RemoteNotifyMessage ), "ipc://remote/message" );
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="ergs"></param>
private void btnSend_Click(object sender, EventArgs ergs) {
// リモート用オブジェクトを作成します。
// 引数なしコンストラクタでなければなりません。
RemoteNotifyMessage message = new RemoteNotifyMessage();
/*
* TODO:
* 「匿名レベル セキュリティ トークンを開けません。」セキュリティ例外が
* でるのをなんとかする。
*/
message.title = tbTitle.Text;
message.fulltext = tbFullText.Text;
//// マーシャリングします。
//RemotingServices.Marshal( message, "message", typeof( RemoteNotifyMessage ) );
}
/// <summary>
///
/// </summary>
private IpcServerChannel server_channel_;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment