zoukankan
html css js c++ java
远程通信
客户端
Client
1
using
System;
2
using
System.Runtime.Remoting.Channels;
3
using
System.Runtime.Remoting.Channels.Tcp;
4
5
namespace
Wrox.ProfessionalCsharp
6
{
7
/**/
///
<summary>
8
///
Summary description for Class1.
9
///
</summary>
10
11
public
class
HelloClient
12
{
13
public
static
void
Main()
14
{
15
ChannelServices.RegisterChannel(
new
TcpClientChanel());
16
Hello obj
=
(Hello)Activator.GetObject(
typeof
(Hello),
17
"
tcp://localhost:8086/Hi
"
);
18
if
(obj
==
null
)
19
{
20
Console.WriteLine(
"
could not locate server
"
);
21
return
;
22
}
23
for
(
int
i
=
0
; i
<
5
; i
++
)
24
{
25
Console.WriteLine(obj.Greeting(
"
Christian
"
));
26
}
27
}
28
}
29
}
服务器端
Server端
1
using
System;
2
using
System.Runtime.Remoting;
3
using
System.Runtime.Remoting.Channels.Tcp;
4
5
namespace
Wrox.ProfessionalCSharp
6
{
7
/**/
///
<summary>
8
///
Summary description for Class1.
9
///
</summary>
10
11
public
class
HelloServer
12
{
13
public
static
void
Main(
string
[] args)
14
{
15
TpcServerChannel channel
=
new
TcpServerChannel(
8086
);
16
ChannelServices.RegisterChannel(channel);
17
RemotingConfiguration.
18
RegisterWellKnownServiceType(
typeof
(Hello),
"
Hi
"
, WellKnownObjectMode.SingleCall);
19
System.Console.WriteLine(
"
hit to exit
"
);
20
System.Console.ReadLine();
21
}
22
}
23
}
查看全文
相关阅读:
java ssh整合报错:java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I
Ubuntu16.04安装搜狗输入法后有黑边问题的解决方法
socket
vim编辑器的使用
linux用户和群组
bash shell
[LightOJ 1128]Greatest Parent
[Luogu P4180][BJWC 2010]严格次小生成树
函数、方法区别
有关_meta内容(持续更新)
原文地址:https://www.cnblogs.com/forestsheep/p/1315867.html
最新文章
Linux系统GNOME主题安装与Tweaks工具使用
js 计算当年还剩多少时间的倒数计时 javascript 原理解析【复制到编辑器查看推荐】
[简洁]JavaScript中添加、移除、移动、复制、创建和查找节点元素
js中的简单数据类型和复杂数据类型的存储
office 2013幻灯片中插入SmartArt图形时出现错误下列一个或多个文件由于包含错误而无法运行
EBS系统启动&停止&增加表空间&替换首页图片
TP5+jquery即点既改
原装即点既改
php分页、正则验证
js正则、js全选、反选、全不选、ajax批删
热门文章
原装数据库连接
hdu 1075 二分搜索
hdu 1005
easyUI--combobox请求数据库方式介绍
window.open---实现弹窗
iframe---切换目录显示相应内容
<a>标签---target属性
感谢博客园
一个经典的字母排列算法
浅析网页meta标签中X-UA-Compatible属性的使用
Copyright © 2011-2022 走看看