Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
若汝棋茗
RRQMSocket
提交
aac929e9
RRQMSocket
项目概览
若汝棋茗
/
RRQMSocket
11 个月 前同步成功
通知
20
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
RRQMSocket
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
aac929e9
编写于
7月 29, 2022
作者:
若
若汝棋茗
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
更新demo
上级
e75525e2
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
29 addition
and
19 deletion
+29
-19
examples/Adapter简单示例/AdapterConsoleApp/Program.cs
examples/Adapter简单示例/AdapterConsoleApp/Program.cs
+0
-5
examples/EventBus简单示例/EventBusClient/EventBusClient.csproj
examples/EventBus简单示例/EventBusClient/EventBusClient.csproj
+2
-1
examples/EventBus简单示例/EventBusServer/EventBusServer.csproj
examples/EventBus简单示例/EventBusServer/EventBusServer.csproj
+2
-1
examples/NAT简单示例/NATServiceConsoleApp/NATServiceConsoleApp.csproj
.../NAT简单示例/NATServiceConsoleApp/NATServiceConsoleApp.csproj
+1
-1
examples/NAT简单示例/NATServiceConsoleApp/Program.cs
examples/NAT简单示例/NATServiceConsoleApp/Program.cs
+12
-3
examples/Udp简单示例/UdpDemoApp/Form1.cs
examples/Udp简单示例/UdpDemoApp/Form1.cs
+12
-8
未找到文件。
examples/Adapter简单示例/AdapterConsoleApp/Program.cs
浏览文件 @
aac929e9
...
...
@@ -42,11 +42,6 @@ namespace AdapterConsoleApp
private
static
void
StartTcpService
()
{
TcpService
service
=
new
TcpService
();
service
.
Connecting
+=
(
client
,
e
)
=>
{
//有客户端正在连接
client
.
SetDataHandlingAdapter
(
new
MyCustomBetweenAndDataHandlingAdapter
());
};
service
.
Connected
+=
(
client
,
e
)
=>
{
};
//有客户端连接
service
.
Disconnected
+=
(
client
,
e
)
=>
{
};
//有客户端断开连接
service
.
Received
+=
(
client
,
byteBlock
,
requestInfo
)
=>
...
...
examples/EventBus简单示例/EventBusClient/EventBusClient.csproj
浏览文件 @
aac929e9
...
...
@@ -7,7 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="TouchSocketPro" Version="0.2.
2
" />
<PackageReference Include="TouchSocketPro" Version="0.2.
3
" />
</ItemGroup>
</Project>
\ No newline at end of file
examples/EventBus简单示例/EventBusServer/EventBusServer.csproj
浏览文件 @
aac929e9
...
...
@@ -7,6 +7,6 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="TouchSocketPro" Version="0.2.
2
" />
<PackageReference Include="TouchSocketPro" Version="0.2.
3
" />
</ItemGroup>
</Project>
\ No newline at end of file
examples/NAT简单示例/NATServiceConsoleApp/NATServiceConsoleApp.csproj
浏览文件 @
aac929e9
...
...
@@ -6,7 +6,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="TouchSocket
" Version="0.2.2
" />
<PackageReference Include="TouchSocket
Pro" Version="0.2.3
" />
</ItemGroup>
</Project>
examples/NAT简单示例/NATServiceConsoleApp/Program.cs
浏览文件 @
aac929e9
...
...
@@ -3,7 +3,9 @@ using TouchSocket.Core;
using
TouchSocket.Core.ByteManager
;
using
TouchSocket.Core.Config
;
using
TouchSocket.Core.Log
;
using
TouchSocket.Core.Plugins
;
using
TouchSocket.Sockets
;
using
TouchSocket.Sockets.Plugins
;
namespace
NATServiceConsoleApp
{
...
...
@@ -18,7 +20,7 @@ namespace NATServiceConsoleApp
service
.
Setup
(
config
);
service
.
Start
();
Console
.
WriteLine
(
"转发服务器已启动。已将7788端口转发到127.0.0.1:7789
与127.0.0.1:7790
地址"
);
Console
.
WriteLine
(
"转发服务器已启动。已将7788端口转发到127.0.0.1:7789地址"
);
}
}
...
...
@@ -32,8 +34,15 @@ namespace NATServiceConsoleApp
{
//此处模拟的是只要连接到NAT服务器,就转发。
//实际上,这个方法可以随时调用。
socketClient
.
AddTargetClient
(
new
TouchSocketConfig
().
SetRemoteIPHost
(
"127.0.0.1:7789"
));
socketClient
.
AddTargetClient
(
new
TouchSocketConfig
().
SetRemoteIPHost
(
"127.0.0.1:7790"
));
socketClient
.
AddTargetClient
(
new
TouchSocketConfig
()
.
SetRemoteIPHost
(
"127.0.0.1:7789"
)
.
ConfigurePlugins
(
a
=>
{
//在企业版中,使用以下任意方式,可实现转发客户端的断线重连。
a
.
Add
<
PollingKeepAlivePlugin
<
TcpClient
>>()
.
SetTick
(
1000
);
//每秒检查
//a.UseReconnection();
}));
}
catch
(
Exception
ex
)
{
...
...
examples/Udp简单示例/UdpDemoApp/Form1.cs
浏览文件 @
aac929e9
...
...
@@ -32,16 +32,20 @@ namespace UdpDemoApp
}
};
if
(
checkBox1
.
Checked
)
{
m_udpSession
.
SetDataHandlingAdapter
(
new
UdpPackageAdapter
());
}
else
{
m_udpSession
.
SetDataHandlingAdapter
(
new
NormalUdpDataHandlingAdapter
());
}
m_udpSession
.
Setup
(
new
TouchSocketConfig
()
.
SetBindIPHost
(
new
IPHost
(
this
.
textBox2
.
Text
))
.
SetUdpDataHandlingAdapter
(()=>
{
if
(
checkBox1
.
Checked
)
{
return
new
UdpPackageAdapter
();
}
else
{
return
new
NormalUdpDataHandlingAdapter
();
}
})
.
ConfigureContainer
(
a
=>
{
a
.
SetSingletonLogger
(
new
LoggerGroup
(
new
EasyLogger
(
this
.
ShowMsg
),
new
FileLogger
()));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录