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
}
查看全文
相关阅读:
完整的UED流程
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
部署方案模板
商城项目合作
架构师分类
k8s视图
虚拟化通信技术
AxureRP8 实现时间功能
在AxureRP8中实现广告文字滚动效果
获取当前网络中的电脑数目及MAC-通过MAC查找IP-通过IP查询机器名
原文地址:https://www.cnblogs.com/forestsheep/p/1315867.html
最新文章
2019-8-15C#MDI窗体实现多窗口效果
常规提权手法
三、部署DNS
二、部署DHCP
一、域控搭建
BOOT目录磁盘占用满处理
git push时出现大文件的处理方法
vmware Esxi 回收Thin模式磁盘空间
flask-restplus
postgres array 语法
热门文章
pyinstaller 加密
wireshark系列
python 注册表
flask_sqlalchemy 2013 Lost connection to MySQL server during query
python导出依赖,记录下坑
m720q
docker启动的时候提示WARNING: IPv4 forwarding is disabled. Networking will not work.
asyncio aiohttp限制并发数量和超时时间
Welcome to IntelliJ IDEA Community 2020.1
缩写概念纪录
Copyright © 2011-2022 走看看