Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
老鱼er
et
提交
b53bd22f
E
et
项目概览
老鱼er
/
et
与 Fork 源项目一致
从无法访问的项目Fork
通知
10
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
et
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b53bd22f
编写于
2月 27, 2015
作者:
T
tanghai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1.修复TBuffer一个bug
2.TNetTest echo 10000次,windows耗时3s,linux耗时6s,性能还行
上级
1d9f5187
变更
19
展开全部
隐藏空白更改
内联
并排
Showing
19 changed file
with
282 addition
and
232 deletion
+282
-232
CSharp/App/Editor/Editor.csproj
CSharp/App/Editor/Editor.csproj
+4
-3
CSharp/App/Editor/app.config
CSharp/App/Editor/app.config
+63
-52
CSharp/App/Infrastructure/app.config
CSharp/App/Infrastructure/app.config
+8
-8
CSharp/App/Modules/BehaviorTreeModule/app.config
CSharp/App/Modules/BehaviorTreeModule/app.config
+8
-8
CSharp/CSharp-Mono.sln
CSharp/CSharp-Mono.sln
+16
-16
CSharp/CSharp-Mono.userprefs
CSharp/CSharp-Mono.userprefs
+1
-1
CSharp/CSharp.sln
CSharp/CSharp.sln
+103
-0
CSharp/Exe/Profile/Profile.csproj
CSharp/Exe/Profile/Profile.csproj
+4
-0
CSharp/Exe/Profile/Program.cs
CSharp/Exe/Profile/Program.cs
+2
-2
CSharp/Platform/TNet/TBuffer.cs
CSharp/Platform/TNet/TBuffer.cs
+13
-5
CSharp/Platform/TNet/TChannel.cs
CSharp/Platform/TNet/TChannel.cs
+8
-8
CSharp/Platform/TNet/TService.cs
CSharp/Platform/TNet/TService.cs
+1
-1
CSharp/Platform/TNet/TSocket.cs
CSharp/Platform/TNet/TSocket.cs
+3
-3
CSharp/Platform/UNet/UPoller.cs
CSharp/Platform/UNet/UPoller.cs
+4
-4
CSharp/Tests/TNetTest/TNetTest.csproj
CSharp/Tests/TNetTest/TNetTest.csproj
+0
-1
CSharp/Tests/TNetTest/TServiceTest.cs
CSharp/Tests/TNetTest/TServiceTest.cs
+29
-18
CSharp/Tests/TNetTest/TcpListenerTest.cs
CSharp/Tests/TNetTest/TcpListenerTest.cs
+0
-95
CSharp/Tests/UNetTest/UNetTest.csproj
CSharp/Tests/UNetTest/UNetTest.csproj
+1
-0
CSharp/Tests/UNetTest/UServiceTest.cs
CSharp/Tests/UNetTest/UServiceTest.cs
+14
-7
未找到文件。
CSharp/App/Editor/Editor.csproj
浏览文件 @
b53bd22f
...
...
@@ -20,6 +20,7 @@
<ExpressionBlendVersion>
4.0.20621.0
</ExpressionBlendVersion>
<SolutionDir
Condition=
"$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'"
>
..\..\CSharp\
</SolutionDir>
<RestorePackages>
true
</RestorePackages>
<IsWebBootstrapper>
false
</IsWebBootstrapper>
<PublishUrl>
发布\
</PublishUrl>
<Install>
true
</Install>
<InstallFrom>
Disk
</InstallFrom>
...
...
@@ -32,12 +33,11 @@
<MapFileExtensions>
true
</MapFileExtensions>
<ApplicationRevision>
0
</ApplicationRevision>
<ApplicationVersion>
1.0.0.%2a
</ApplicationVersion>
<IsWebBootstrapper>
false
</IsWebBootstrapper>
<UseApplicationTrust>
false
</UseApplicationTrust>
<BootstrapperEnabled>
true
</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Debug|x86' "
>
<PlatformTarget>
x86
</PlatformTarget>
<PlatformTarget>
AnyCPU
</PlatformTarget>
<DebugSymbols>
true
</DebugSymbols>
<DebugType>
full
</DebugType>
<Optimize>
false
</Optimize>
...
...
@@ -45,7 +45,7 @@
<DefineConstants>
DEBUG;TRACE
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
<Prefer32Bit>
fals
e
</Prefer32Bit>
<Prefer32Bit>
tru
e
</Prefer32Bit>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Release|x86' "
>
<PlatformTarget>
x86
</PlatformTarget>
...
...
@@ -96,6 +96,7 @@
<Reference
Include=
"System.Data"
/>
<Reference
Include=
"System.Runtime.Serialization"
/>
<Reference
Include=
"System.ServiceModel"
/>
<Reference
Include=
"System.Web.Extensions"
/>
<Reference
Include=
"System.Xml"
/>
<Reference
Include=
"System.Core"
/>
<Reference
Include=
"System.Xaml"
>
...
...
CSharp/App/Editor/app.config
浏览文件 @
b53bd22f
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
configuration
>
<
runtime
>
<
assemblyBinding
xmlns
=
"urn:schemas-microsoft-com:asm.v1"
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"Microsoft.Practices.Prism"
publicKeyToken
=
"31bf3856ad364e35"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-4.1.0.0"
newVersion
=
"4.1.0.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"MySql.Data"
publicKeyToken
=
"c5687fc88969c44d"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-6.6.4.0"
newVersion
=
"6.6.4.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"Microsoft.Practices.ServiceLocation"
publicKeyToken
=
"31bf3856ad364e35"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-1.3.0.0"
newVersion
=
"1.3.0.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.Windows.Interactivity"
publicKeyToken
=
"31bf3856ad364e35"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-4.0.0.0"
newVersion
=
"4.0.0.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"Microsoft.Practices.Prism.SharedInterfaces"
publicKeyToken
=
"31bf3856ad364e35"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-1.1.1.0"
newVersion
=
"1.1.1.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"Microsoft.Practices.Prism.PubSubEvents"
publicKeyToken
=
"31bf3856ad364e35"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-1.1.0.0"
newVersion
=
"1.1.0.0"
/>
</
dependentAssembly
>
</
assemblyBinding
>
</
runtime
>
<
startup
>
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.5.1"
/>
</
startup
>
<
appSettings
>
<
add
key
=
"IP"
value
=
"192.168.11.95"
/>
<
add
key
=
"Port"
value
=
"8888"
/>
<
add
key
=
"Account"
value
=
"egametang@163.com"
/>
<
add
key
=
"Password"
value
=
"163bio1"
/>
<
add
key
=
"NodePath"
value
=
"D:\Source\Demo\battledemo\Assets\Resources\Config\node.bytes"
/>
</
appSettings
>
<
system
.
serviceModel
>
<
bindings
>
<
netTcpBinding
>
<
binding
name
=
"NetTcpBinding_Calculator"
/>
</
netTcpBinding
>
</
bindings
>
<
client
>
<
endpoint
address
=
"net.tcp://localhost:10000/Calculator/"
binding
=
"netTcpBinding"
bindingConfiguration
=
"NetTcpBinding_Calculator"
contract
=
"Proxy.Calculator"
name
=
"NetTcpBinding_Calculator"
>
</
endpoint
>
</
client
>
</
system
.
serviceModel
>
<
runtime
>
<
assemblyBinding
xmlns
=
"urn:schemas-microsoft-com:asm.v1"
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"Microsoft.Practices.Prism"
publicKeyToken
=
"31bf3856ad364e35"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-4.1.0.0"
newVersion
=
"4.1.0.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"MySql.Data"
publicKeyToken
=
"c5687fc88969c44d"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-6.6.4.0"
newVersion
=
"6.6.4.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"Microsoft.Practices.ServiceLocation"
publicKeyToken
=
"31bf3856ad364e35"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-1.3.0.0"
newVersion
=
"1.3.0.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.Windows.Interactivity"
publicKeyToken
=
"31bf3856ad364e35"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-4.0.0.0"
newVersion
=
"4.0.0.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"Microsoft.Practices.Prism.SharedInterfaces"
publicKeyToken
=
"31bf3856ad364e35"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-1.1.1.0"
newVersion
=
"1.1.1.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"Microsoft.Practices.Prism.PubSubEvents"
publicKeyToken
=
"31bf3856ad364e35"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-1.1.0.0"
newVersion
=
"1.1.0.0"
/>
</
dependentAssembly
>
</
assemblyBinding
>
</
runtime
>
<
startup
>
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.5.1"
/>
</
startup
>
<
appSettings
>
<
add
key
=
"IP"
value
=
"192.168.11.95"
/>
<
add
key
=
"Port"
value
=
"8888"
/>
<
add
key
=
"Account"
value
=
"egametang@163.com"
/>
<
add
key
=
"Password"
value
=
"163bio1"
/>
<
add
key
=
"NodePath"
value
=
"D:\Source\Demo\battledemo\Assets\Resources\Config\node.bytes"
/>
<
add
key
=
"ClientSettingsProvider.ServiceUri"
value
=
""
/>
</
appSettings
>
<
system
.
serviceModel
>
<
bindings
>
<
netTcpBinding
>
<
binding
name
=
"NetTcpBinding_Calculator"
/>
</
netTcpBinding
>
</
bindings
>
<
client
>
<
endpoint
address
=
"net.tcp://localhost:10000/Calculator/"
binding
=
"netTcpBinding"
bindingConfiguration
=
"NetTcpBinding_Calculator"
contract
=
"Proxy.Calculator"
name
=
"NetTcpBinding_Calculator"
>
</
endpoint
>
</
client
>
</
system
.
serviceModel
>
<
system
.
web
>
<
membership
defaultProvider
=
"ClientAuthenticationMembershipProvider"
>
<
providers
>
<
add
name
=
"ClientAuthenticationMembershipProvider"
type
=
"System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
serviceUri
=
""
/>
</
providers
>
</
membership
>
<
roleManager
defaultProvider
=
"ClientRoleProvider"
enabled
=
"true"
>
<
providers
>
<
add
name
=
"ClientRoleProvider"
type
=
"System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
serviceUri
=
""
cacheTimeout
=
"86400"
/>
</
providers
>
</
roleManager
>
</
system
.
web
>
</
configuration
>
CSharp/App/Infrastructure/app.config
浏览文件 @
b53bd22f
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
configuration
>
<
runtime
>
<
assemblyBinding
xmlns
=
"urn:schemas-microsoft-com:asm.v1"
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"Microsoft.Practices.ServiceLocation"
publicKeyToken
=
"31bf3856ad364e35"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-1.3.0.0"
newVersion
=
"1.3.0.0"
/>
<
assemblyIdentity
name
=
"Microsoft.Practices.ServiceLocation"
publicKeyToken
=
"31bf3856ad364e35"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-1.3.0.0"
newVersion
=
"1.3.0.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"Microsoft.Practices.Prism.SharedInterfaces"
publicKeyToken
=
"31bf3856ad364e35"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-1.1.1.0"
newVersion
=
"1.1.1.0"
/>
<
assemblyIdentity
name
=
"Microsoft.Practices.Prism.SharedInterfaces"
publicKeyToken
=
"31bf3856ad364e35"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-1.1.1.0"
newVersion
=
"1.1.1.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"Microsoft.Practices.Prism.PubSubEvents"
publicKeyToken
=
"31bf3856ad364e35"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-1.1.0.0"
newVersion
=
"1.1.0.0"
/>
<
assemblyIdentity
name
=
"Microsoft.Practices.Prism.PubSubEvents"
publicKeyToken
=
"31bf3856ad364e35"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-1.1.0.0"
newVersion
=
"1.1.0.0"
/>
</
dependentAssembly
>
</
assemblyBinding
>
</
runtime
>
<
startup
><
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.5.1"
/></
startup
></
configuration
>
<
startup
><
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.5.1"
/></
startup
></
configuration
>
CSharp/App/Modules/BehaviorTreeModule/app.config
浏览文件 @
b53bd22f
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
configuration
>
<
runtime
>
<
assemblyBinding
xmlns
=
"urn:schemas-microsoft-com:asm.v1"
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"Microsoft.Practices.ServiceLocation"
publicKeyToken
=
"31bf3856ad364e35"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-1.3.0.0"
newVersion
=
"1.3.0.0"
/>
<
assemblyIdentity
name
=
"Microsoft.Practices.ServiceLocation"
publicKeyToken
=
"31bf3856ad364e35"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-1.3.0.0"
newVersion
=
"1.3.0.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"Microsoft.Practices.Prism.SharedInterfaces"
publicKeyToken
=
"31bf3856ad364e35"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-1.1.1.0"
newVersion
=
"1.1.1.0"
/>
<
assemblyIdentity
name
=
"Microsoft.Practices.Prism.SharedInterfaces"
publicKeyToken
=
"31bf3856ad364e35"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-1.1.1.0"
newVersion
=
"1.1.1.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"Microsoft.Practices.Prism.PubSubEvents"
publicKeyToken
=
"31bf3856ad364e35"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-1.1.0.0"
newVersion
=
"1.1.0.0"
/>
<
assemblyIdentity
name
=
"Microsoft.Practices.Prism.PubSubEvents"
publicKeyToken
=
"31bf3856ad364e35"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-1.1.0.0"
newVersion
=
"1.1.0.0"
/>
</
dependentAssembly
>
</
assemblyBinding
>
</
runtime
>
<
startup
><
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.5.1"
/></
startup
></
configuration
>
<
startup
><
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.5.1"
/></
startup
></
configuration
>
CSharp/CSharp-Mono.sln
浏览文件 @
b53bd22f
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 201
3
# Visual Studio 201
2
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Game", "Game", "{BEA22CC3-9FA8-4663-82DC-6B2119A8E35E}"
...
...
@@ -39,14 +39,18 @@ Global
{0608C0C1-F584-4092-AAF9-1E99A78E3703}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0608C0C1-F584-4092-AAF9-1E99A78E3703}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0608C0C1-F584-4092-AAF9-1E99A78E3703}.Release|Any CPU.Build.0 = Release|Any CPU
{1888D319-0495-43F3-BA8D-163EC20D9437}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1888D319-0495-43F3-BA8D-163EC20D9437}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1888D319-0495-43F3-BA8D-163EC20D9437}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1888D319-0495-43F3-BA8D-163EC20D9437}.Release|Any CPU.Build.0 = Release|Any CPU
{47A7404D-F501-43C5-8183-4B4E9E8C24B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{47A7404D-F501-43C5-8183-4B4E9E8C24B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{47A7404D-F501-43C5-8183-4B4E9E8C24B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{47A7404D-F501-43C5-8183-4B4E9E8C24B2}.Release|Any CPU.Build.0 = Release|Any CPU
{7D5B90DF-43AC-42B8-9A52-2B985BC42A5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7D5B90DF-43AC-42B8-9A52-2B985BC42A5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7D5B90DF-43AC-42B8-9A52-2B985BC42A5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7D5B90DF-43AC-42B8-9A52-2B985BC42A5C}.Release|Any CPU.Build.0 = Release|Any CPU
{F06B995E-6508-4C5C-A396-554316C9215D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F06B995E-6508-4C5C-A396-554316C9215D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F06B995E-6508-4C5C-A396-554316C9215D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F06B995E-6508-4C5C-A396-554316C9215D}.Release|Any CPU.Build.0 = Release|Any CPU
{B1B78524-3F75-40D7-BF12-10B25A00C590}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B1B78524-3F75-40D7-BF12-10B25A00C590}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B1B78524-3F75-40D7-BF12-10B25A00C590}.Release|Any CPU.ActiveCfg = Release|Any CPU
...
...
@@ -59,21 +63,14 @@ Global
{DEF89A61-8AC7-4CCD-80B8-FC6AA2571E35}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DEF89A61-8AC7-4CCD-80B8-FC6AA2571E35}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DEF89A61-8AC7-4CCD-80B8-FC6AA2571E35}.Release|Any CPU.Build.0 = Release|Any CPU
{1888D319-0495-43F3-BA8D-163EC20D9437}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1888D319-0495-43F3-BA8D-163EC20D9437}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1888D319-0495-43F3-BA8D-163EC20D9437}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1888D319-0495-43F3-BA8D-163EC20D9437}.Release|Any CPU.Build.0 = Release|Any CPU
{47A7404D-F501-43C5-8183-4B4E9E8C24B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{47A7404D-F501-43C5-8183-4B4E9E8C24B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{47A7404D-F501-43C5-8183-4B4E9E8C24B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{47A7404D-F501-43C5-8183-4B4E9E8C24B2}.Release|Any CPU.Build.0 = Release|Any CPU
{EA0D6994-A254-4DFE-9ADC-A29B7005419F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EA0D6994-A254-4DFE-9ADC-A29B7005419F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EA0D6994-A254-4DFE-9ADC-A29B7005419F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EA0D6994-A254-4DFE-9ADC-A29B7005419F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
{F06B995E-6508-4C5C-A396-554316C9215D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F06B995E-6508-4C5C-A396-554316C9215D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F06B995E-6508-4C5C-A396-554316C9215D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F06B995E-6508-4C5C-A396-554316C9215D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{0608C0C1-F584-4092-AAF9-1E99A78E3703} = {BEA22CC3-9FA8-4663-82DC-6B2119A8E35E}
...
...
@@ -86,4 +83,7 @@ Global
{47A7404D-F501-43C5-8183-4B4E9E8C24B2} = {C69F1D82-6684-49D1-B388-CA4AECD6AD0D}
{EA0D6994-A254-4DFE-9ADC-A29B7005419F} = {C6DA219F-E1FD-4F0D-8A61-47419D7543B7}
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
CSharp/CSharp-Mono.userprefs
浏览文件 @
b53bd22f
<Properties StartupItem="
Platform\Common\Common
.csproj">
<Properties StartupItem="
Exe\Profile\Profile
.csproj">
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
<MonoDevelop.Ide.Workbench ActiveDocument="Game\Model\Component\NetworkComponent.cs">
<Files>
...
...
CSharp/CSharp.sln
浏览文件 @
b53bd22f
此差异已折叠。
点击以展开。
CSharp/Exe/Profile/Profile.csproj
浏览文件 @
b53bd22f
...
...
@@ -48,6 +48,10 @@
<None
Include=
"App.config"
/>
</ItemGroup>
<ItemGroup>
<ProjectReference
Include=
"..\..\Tests\TNetTest\TNetTest.csproj"
>
<Project>
{1888D319-0495-43F3-BA8D-163EC20D9437}
</Project>
<Name>
TNetTest
</Name>
</ProjectReference>
<ProjectReference
Include=
"..\..\Tests\UNetTest\UNetTest.csproj"
>
<Project>
{47A7404D-F501-43C5-8183-4B4E9E8C24B2}
</Project>
<Name>
UNetTest
</Name>
...
...
CSharp/Exe/Profile/Program.cs
浏览文件 @
b53bd22f
using
Common.Logger
;
using
U
NetTest
;
using
T
NetTest
;
namespace
Profile
{
...
...
@@ -7,7 +7,7 @@ namespace Profile
{
private
static
void
Main
(
string
[]
args
)
{
UServiceTest
test
=
new
U
ServiceTest
();
TServiceTest
test
=
new
T
ServiceTest
();
Log
.
Debug
(
"Profile start"
);
test
.
ClientSendToServer
();
Log
.
Debug
(
"Profile stop"
);
...
...
CSharp/Platform/TNet/TBuffer.cs
浏览文件 @
b53bd22f
...
...
@@ -13,6 +13,11 @@ namespace TNet
public
int
FirstIndex
{
get
;
set
;
}
public
TBuffer
()
{
this
.
bufferList
.
AddLast
(
new
byte
[
ChunkSize
]);
}
public
int
Count
{
get
...
...
@@ -63,8 +68,9 @@ namespace TNet
{
if
(
this
.
Count
<
buffer
.
Length
||
buffer
.
Length
==
0
)
{
throw
new
Exception
(
string
.
Format
(
"bufferList size < n, bufferList: {0} buffer length: {1}"
,
this
.
Count
,
buffer
.
Length
));
throw
new
Exception
(
string
.
Format
(
"bufferList size < n, bufferList: {0} buffer length: {1}"
,
this
.
Count
,
buffer
.
Length
));
}
int
alreadyCopyCount
=
0
;
while
(
alreadyCopyCount
<
buffer
.
Length
)
...
...
@@ -79,7 +85,7 @@ namespace TNet
else
{
Array
.
Copy
(
this
.
bufferList
.
First
.
Value
,
this
.
FirstIndex
,
buffer
,
alreadyCopyCount
,
ChunkSize
-
this
.
FirstIndex
);
ChunkSize
-
this
.
FirstIndex
);
alreadyCopyCount
+=
ChunkSize
-
this
.
FirstIndex
;
this
.
FirstIndex
=
0
;
this
.
bufferList
.
RemoveFirst
();
...
...
@@ -92,10 +98,12 @@ namespace TNet
int
alreadyCopyCount
=
0
;
while
(
alreadyCopyCount
<
buffer
.
Length
)
{
if
(
this
.
LastIndex
==
0
)
if
(
this
.
LastIndex
==
ChunkSize
)
{
this
.
bufferList
.
AddLast
(
new
byte
[
ChunkSize
]);
this
.
LastIndex
=
0
;
}
int
n
=
buffer
.
Length
-
alreadyCopyCount
;
if
(
ChunkSize
-
this
.
LastIndex
>
n
)
{
...
...
@@ -108,7 +116,7 @@ namespace TNet
Array
.
Copy
(
buffer
,
alreadyCopyCount
,
this
.
bufferList
.
Last
.
Value
,
this
.
LastIndex
,
ChunkSize
-
this
.
LastIndex
);
alreadyCopyCount
+=
ChunkSize
-
this
.
LastIndex
;
this
.
LastIndex
=
0
;
this
.
LastIndex
=
ChunkSize
;
}
}
}
...
...
CSharp/Platform/TNet/TChannel.cs
浏览文件 @
b53bd22f
...
...
@@ -9,7 +9,7 @@ namespace TNet
{
internal
class
TChannel
:
AChannel
{
private
const
int
SendInterval
=
5
0
;
private
const
int
SendInterval
=
0
;
private
readonly
TService
service
;
private
TSocket
socket
;
...
...
@@ -130,8 +130,9 @@ namespace TNet
{
sendSize
=
this
.
sendBuffer
.
Count
;
}
int
n
=
await
this
.
socket
.
SendAsync
(
this
.
sendBuffer
.
First
,
this
.
sendBuffer
.
FirstIndex
,
sendSize
);
int
n
=
await
this
.
socket
.
SendAsync
(
this
.
sendBuffer
.
First
,
this
.
sendBuffer
.
FirstIndex
,
sendSize
);
this
.
sendBuffer
.
FirstIndex
+=
n
;
if
(
this
.
sendBuffer
.
FirstIndex
==
TBuffer
.
ChunkSize
)
{
...
...
@@ -142,7 +143,7 @@ namespace TNet
}
catch
(
Exception
e
)
{
Log
.
Trace
(
e
.
ToString
());
Log
.
Debug
(
e
.
ToString
());
}
this
.
sendTimer
=
ObjectId
.
Empty
;
...
...
@@ -154,10 +155,9 @@ namespace TNet
{
while
(
true
)
{
int
n
=
await
this
.
socket
.
RecvAsync
(
this
.
recvBuffer
.
Last
,
this
.
recvBuffer
.
LastIndex
,
TBuffer
.
ChunkSize
-
this
.
recvBuffer
.
LastIndex
);
int
n
=
await
this
.
socket
.
RecvAsync
(
this
.
recvBuffer
.
Last
,
this
.
recvBuffer
.
LastIndex
,
TBuffer
.
ChunkSize
-
this
.
recvBuffer
.
LastIndex
);
if
(
n
==
0
)
{
break
;
...
...
CSharp/Platform/TNet/TService.cs
浏览文件 @
b53bd22f
...
...
@@ -139,7 +139,7 @@ namespace TNet
{
while
(!
isStop
)
{
this
.
RunOnce
(
1
);
this
.
RunOnce
(
0
);
this
.
timerManager
.
Refresh
();
}
}
...
...
CSharp/Platform/TNet/TSocket.cs
浏览文件 @
b53bd22f
...
...
@@ -2,6 +2,7 @@
using
System.Net
;
using
System.Net.Sockets
;
using
System.Threading.Tasks
;
using
Common.Helper
;
using
Common.Logger
;
namespace
TNet
...
...
@@ -33,8 +34,8 @@ namespace TNet
{
get
{
return
((
IPEndPoint
)
this
.
socket
.
RemoteEndPoint
).
Address
+
":"
+
((
IPEndPoint
)
this
.
socket
.
RemoteEndPoint
)
.
Port
;
IPEndPoint
ipEndPoint
=
(
IPEndPoint
)
this
.
socket
.
RemoteEndPoint
;
return
ipEndPoint
.
Address
+
":"
+
ipEndPoint
.
Port
;
}
}
...
...
@@ -171,7 +172,6 @@ namespace TNet
private
static
void
OnRecvComplete
(
SocketAsyncEventArgs
e
)
{
Log
.
Debug
(
"OnRecvComplete: "
+
e
.
BytesTransferred
);
var
tcs
=
(
TaskCompletionSource
<
int
>)
e
.
UserToken
;
e
.
UserToken
=
null
;
if
(
e
.
SocketError
!=
SocketError
.
Success
)
...
...
CSharp/Platform/UNet/UPoller.cs
浏览文件 @
b53bd22f
...
...
@@ -30,8 +30,8 @@ namespace UNet
{
UAddress
address
=
new
UAddress
(
hostName
,
port
);
ENetAddress
nativeAddress
=
address
.
Struct
;
this
.
host
=
NativeMethods
.
EnetHostCreate
(
ref
nativeAddress
,
NativeMethods
.
ENET_PROTOCOL_MAXIMUM_PEER_ID
,
0
,
0
,
0
);
this
.
host
=
NativeMethods
.
EnetHostCreate
(
ref
nativeAddress
,
NativeMethods
.
ENET_PROTOCOL_MAXIMUM_PEER_ID
,
0
,
0
,
0
);
if
(
this
.
host
==
IntPtr
.
Zero
)
{
...
...
@@ -43,8 +43,8 @@ namespace UNet
public
UPoller
()
{
this
.
host
=
NativeMethods
.
EnetHostCreate
(
IntPtr
.
Zero
,
NativeMethods
.
ENET_PROTOCOL_MAXIMUM_PEER_ID
,
0
,
0
,
0
);
this
.
host
=
NativeMethods
.
EnetHostCreate
(
IntPtr
.
Zero
,
NativeMethods
.
ENET_PROTOCOL_MAXIMUM_PEER_ID
,
0
,
0
,
0
);
if
(
this
.
host
==
IntPtr
.
Zero
)
{
...
...
CSharp/Tests/TNetTest/TNetTest.csproj
浏览文件 @
b53bd22f
...
...
@@ -38,7 +38,6 @@
</ItemGroup>
<ItemGroup>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
<Compile
Include=
"TcpListenerTest.cs"
/>
<Compile
Include=
"TServiceTest.cs"
/>
</ItemGroup>
<ItemGroup>
...
...
CSharp/Tests/TNetTest/TServiceTest.cs
浏览文件 @
b53bd22f
...
...
@@ -11,15 +11,18 @@ namespace TNetTest
[
TestFixture
]
public
class
TServiceTest
{
private
const
int
echoTimes
=
10000
;
private
readonly
Barrier
barrier
=
new
Barrier
(
3
);
private
async
void
ClientEvent
(
IService
service
,
string
hostName
,
ushort
port
)
{
AChannel
channel
=
await
service
.
GetChannel
(
hostName
,
port
);
channel
.
SendAsync
(
"0123456789"
.
ToByteArray
());
byte
[]
bytes
=
await
channel
.
RecvAsync
();
CollectionAssert
.
AreEqual
(
"9876543210"
.
ToByteArray
(),
bytes
);
for
(
int
i
=
0
;
i
<
echoTimes
;
++
i
)
{
channel
.
SendAsync
(
"0123456789"
.
ToByteArray
());
byte
[]
bytes
=
await
channel
.
RecvAsync
();
CollectionAssert
.
AreEqual
(
"9876543210"
.
ToByteArray
(),
bytes
);
}
this
.
barrier
.
RemoveParticipant
();
}
...
...
@@ -27,10 +30,13 @@ namespace TNetTest
private
async
void
ServerEvent
(
IService
service
)
{
AChannel
channel
=
await
service
.
GetChannel
();
byte
[]
bytes
=
await
channel
.
RecvAsync
();
CollectionAssert
.
AreEqual
(
"0123456789"
.
ToByteArray
(),
bytes
);
Array
.
Reverse
(
bytes
);
channel
.
SendAsync
(
bytes
);
for
(
int
i
=
0
;
i
<
echoTimes
;
++
i
)
{
byte
[]
bytes
=
await
channel
.
RecvAsync
();
CollectionAssert
.
AreEqual
(
"0123456789"
.
ToByteArray
(),
bytes
);
Array
.
Reverse
(
bytes
);
channel
.
SendAsync
(
bytes
);
}
this
.
barrier
.
RemoveParticipant
();
}
...
...
@@ -40,21 +46,26 @@ namespace TNetTest
{
const
string
hostName
=
"127.0.0.1"
;
const
ushort
port
=
8889
;
IService
clientService
=
new
TService
();
IService
serverService
=
new
TService
(
hostName
,
8889
);
using
(
IService
clientService
=
new
TService
())
using
(
IService
serverService
=
new
TService
(
hostName
,
8889
))
{
Task
task1
=
Task
.
Factory
.
StartNew
(()
=>
clientService
.
Start
(),
TaskCreationOptions
.
LongRunning
);
Task
task2
=
Task
.
Factory
.
StartNew
(()
=>
serverService
.
Start
(),
TaskCreationOptions
.
LongRunning
);
Task
.
Factory
.
StartNew
(()
=>
clientService
.
Start
(),
TaskCreationOptions
.
LongRunning
);
Task
.
Factory
.
StartNew
(()
=>
serverService
.
Start
(),
TaskCreationOptions
.
LongRunning
);
// 往server host线程增加事件,accept
serverService
.
Add
(()
=>
this
.
ServerEvent
(
serverService
)
);
// 往server host线程增加事件,accept
serverService
.
Add
(()
=>
this
.
ServerEvent
(
serverService
));
Thread
.
Sleep
(
1000
);
Thread
.
Sleep
(
1000
);
// 往client host线程增加事件,client线程连接server
clientService
.
Add
(()
=>
this
.
ClientEvent
(
clientService
,
hostName
,
port
));
// 往client host线程增加事件,client线程连接server
clientService
.
Add
(()
=>
this
.
ClientEvent
(
clientService
,
hostName
,
port
));
this
.
barrier
.
SignalAndWait
();
this
.
barrier
.
SignalAndWait
();
serverService
.
Add
(
serverService
.
Stop
);
clientService
.
Add
(
clientService
.
Stop
);
Task
.
WaitAll
(
task1
,
task2
);
}
}
}
}
\ No newline at end of file
CSharp/Tests/TNetTest/TcpListenerTest.cs
已删除
100644 → 0
浏览文件 @
1d9f5187
using
System
;
using
System.Net
;
using
System.Net.Sockets
;
using
System.Threading
;
using
Common.Helper
;
using
Common.Logger
;
using
NUnit.Framework
;
namespace
TNetTest
{
[
TestFixture
]
public
class
TcpListenerTest
{
private
const
ushort
port
=
11111
;
private
int
count
;
private
readonly
Barrier
barrier
=
new
Barrier
(
2
);
private
readonly
object
lockObject
=
new
object
();
[
Test
]
public
void
AcceptAsync
()
{
Thread
thread1
=
new
Thread
(
this
.
Server
);
thread1
.
Start
();
Thread
.
Sleep
(
2
);
for
(
int
i
=
0
;
i
<
1
;
++
i
)
{
Thread
thread
=
new
Thread
(
this
.
Client
);
thread
.
Start
();
}
this
.
barrier
.
SignalAndWait
();
}
private
async
void
Client
()
{
using
(
TcpClient
tcpClient
=
new
TcpClient
(
AddressFamily
.
InterNetwork
))
{
await
tcpClient
.
ConnectAsync
(
"127.0.0.1"
,
port
);
using
(
NetworkStream
ns
=
tcpClient
.
GetStream
())
{
try
{
var
bytes
=
"tanghai"
.
ToByteArray
();
for
(
int
i
=
0
;
i
<
100
;
++
i
)
{
await
ns
.
WriteAsync
(
bytes
,
0
,
bytes
.
Length
);
int
n
=
await
ns
.
ReadAsync
(
bytes
,
0
,
bytes
.
Length
);
Assert
.
AreEqual
(
7
,
n
);
}
}
catch
(
Exception
e
)
{
Log
.
Debug
(
e
.
ToString
());
}
}
}
this
.
barrier
.
RemoveParticipants
(
1
);
}
private
async
void
Server
()
{
TcpListener
tcpListener
=
new
TcpListener
(
IPAddress
.
Parse
(
"127.0.0.1"
),
port
);
tcpListener
.
Start
();
while
(
this
.
count
!=
1
)
{
Socket
socket
=
await
tcpListener
.
AcceptSocketAsync
();
NetworkStream
ns
=
new
NetworkStream
(
socket
);
this
.
Response
(
ns
);
}
}
private
async
void
Response
(
NetworkStream
ns
)
{
try
{
var
bytes
=
new
byte
[
1000
];
for
(
int
i
=
0
;
i
<
100
;
++
i
)
{
int
n
=
await
ns
.
ReadAsync
(
bytes
,
0
,
100
);
await
ns
.
WriteAsync
(
bytes
,
0
,
n
);
}
lock
(
this
.
lockObject
)
{
++
this
.
count
;
}
}
catch
(
Exception
e
)
{
Log
.
Debug
(
e
.
ToString
());
}
}
}
}
\ No newline at end of file
CSharp/Tests/UNetTest/UNetTest.csproj
浏览文件 @
b53bd22f
...
...
@@ -20,6 +20,7 @@
<DefineConstants>
DEBUG;TRACE
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
<PlatformTarget>
x86
</PlatformTarget>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "
>
<DebugType>
pdbonly
</DebugType>
...
...
CSharp/Tests/UNetTest/UServiceTest.cs
浏览文件 @
b53bd22f
...
...
@@ -12,25 +12,32 @@ namespace UNetTest
[
TestFixture
]
public
class
UServiceTest
{
private
const
int
echoTimes
=
10000
;
private
readonly
Barrier
barrier
=
new
Barrier
(
2
);
private
async
void
ClientEvent
(
IService
clientService
,
string
hostName
,
ushort
port
)
{
AChannel
channel
=
await
clientService
.
GetChannel
(
hostName
,
port
);
channel
.
SendAsync
(
"0123456789"
.
ToByteArray
());
for
(
int
i
=
0
;
i
<
echoTimes
;
++
i
)
{
channel
.
SendAsync
(
"0123456789"
.
ToByteArray
());
byte
[]
bytes
=
await
channel
.
RecvAsync
();
CollectionAssert
.
AreEqual
(
"9876543210"
.
ToByteArray
(),
bytes
);
byte
[]
bytes
=
await
channel
.
RecvAsync
();
CollectionAssert
.
AreEqual
(
"9876543210"
.
ToByteArray
(),
bytes
);
}
barrier
.
RemoveParticipant
();
}
private
async
void
ServerEvent
(
IService
service
)
{
AChannel
channel
=
await
service
.
GetChannel
();
byte
[]
bytes
=
await
channel
.
RecvAsync
();
CollectionAssert
.
AreEqual
(
"0123456789"
.
ToByteArray
(),
bytes
);
Array
.
Reverse
(
bytes
);
channel
.
SendAsync
(
bytes
);
for
(
int
i
=
0
;
i
<
echoTimes
;
++
i
)
{
byte
[]
bytes
=
await
channel
.
RecvAsync
();
CollectionAssert
.
AreEqual
(
"0123456789"
.
ToByteArray
(),
bytes
);
Array
.
Reverse
(
bytes
);
channel
.
SendAsync
(
bytes
);
}
}
[
Test
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录