简单的.NETRemoting
来源:互联网 发布:linux apt get 修改源 编辑:程序博客网 时间:2024/05/23 12:52
创建一类库:其中写构造函数和服务器端真正要调用的方法,这就是remoting中的代理
每个文件都是一单独的工程
文件一:
using System;
using System.Collections.Generic;
using System.Text;
namespace InterRemoting
{
public class RemotingClass:MarshalByRefObject
{
public RemotingClass()
{
System.Console.WriteLine("New Referance Added!");
}
public int sum(int a, int b)
{
return a + b;
}
}
}
创建一控制台程序:
用来注册信道和具体方法--服务器端
文件二:
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using InterRemoting;
namespace RemotingClient
{
class Program
{
static void Main(string[] args)
{
ChannelServices.RegisterChannel(new TcpClientChannel(),false);
RemotingClass remoteobj = (RemotingClass)Activator.GetObject(typeof(RemotingClass), "tcp://localhost:6666/myRemoteObject");
Console.WriteLine("1 + 2 = " + remoteobj.sum(1,2).ToString());
Console.ReadLine();
}
}
}
创建一控制台程序:
用来来调用服务器端端口的方法--客户端
文件三:
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using InterRemoting;
namespace RemotingClient
{
class Program
{
static void Main(string[] args)
{
ChannelServices.RegisterChannel(new TcpClientChannel(),false);
RemotingClass remoteobj = (RemotingClass)Activator.GetObject(typeof(RemotingClass), "tcp://localhost:6666/myRemoteObject");
Console.WriteLine("1 + 2 = " + remoteobj.sum(1,2).ToString());
Console.ReadLine();
}
}
}
- 简单的.NETRemoting
- .NETRemoting框架的使用
- WebService与.NetRemoting的区别
- 微软的远程处理框架.NETRemoting(2)
- 7-.netRemoting
- .netremoting激活模式
- 远程数据传输之NetRemoting
- 性能比较:.NETRemoting 与 ASP.NET Web 服务
- .NETRemoting中的几个重要概念和实现方法
- .NETRemoting中的几个重要概念和实现方法
- .NET简谈组件程序设计之(初识NetRemoting)
- .NET简谈组件程序设计之(详解NetRemoting结构)
- .NET简谈组件程序设计之(详解NetRemoting结构)
- 简单的,简单的
- 简单的
- 简单破解的简单步骤
- 简单的爱,简单的幸福
- 杀毒软件的简单实现的简单实现
- asddddddddddddddddddddddd
- 超级实用的几种表单校验效果
- bfin-xxx-gcc-4.3.1中config.status的生成及运行(2):Shell检测
- 疑问声中刘翔“消失” 不露锋芒却仍让罗伯斯敬畏
- 右下角弹出类似QQ或MSN消息提示
- 简单的.NETRemoting
- 莫斯科获全球“最贵城市”三连冠
- Wince的详细编译过程
- seo个人见解
- 关于 C++ 中的类型成员
- 对我工作的这三年总结一下吧
- 磁盘空间不够时,oracle如何腾出空间
- Visual Studio 2008新特性
- 一个基于RSA算法的Java数字签名例子