This commit is contained in:
sin365 2021-12-13 23:53:01 +08:00
parent 155df3f1e9
commit af0e472b42
10 changed files with 47 additions and 50 deletions

View File

@ -50,7 +50,32 @@
"ProjectGuid": "5559b94a-da9e-4cf7-b799-2bcaa1f11f49", "ProjectGuid": "5559b94a-da9e-4cf7-b799-2bcaa1f11f49",
"DisplayName": "SimpleServer", "DisplayName": "SimpleServer",
"ColorIndex": 9 "ColorIndex": 9
},
"895995de-556a-437e-8e6f-1a1fe8736386": {
"ProjectGuid": "895995de-556a-437e-8e6f-1a1fe8736386",
"DisplayName": "HaoYueNet.ClientNetworkNet4x",
"ColorIndex": 10
},
"a2fe74e1-b743-11d0-ae1a-00a0c90fffc3": {
"ProjectGuid": "a2fe74e1-b743-11d0-ae1a-00a0c90fffc3",
"DisplayName": "杂项文件",
"ColorIndex": -1
},
"27e139e2-f5f5-47df-99d8-04dc7ebebeec": {
"ProjectGuid": "27e139e2-f5f5-47df-99d8-04dc7ebebeec",
"DisplayName": "HaoYueNet.ClientNetworkNet4x",
"ColorIndex": 11
},
"d0066c06-a89a-4e05-80e0-d8232fb0ff3c": {
"ProjectGuid": "d0066c06-a89a-4e05-80e0-d8232fb0ff3c",
"DisplayName": "NetLib",
"ColorIndex": 12
},
"a741610f-29b9-4f0e-9a3d-0b3e1318f031": {
"ProjectGuid": "a741610f-29b9-4f0e-9a3d-0b3e1318f031",
"DisplayName": "HaoYueNet.ClientNetworkNet4x",
"ColorIndex": 13
} }
}, },
"NextColorIndex": 10 "NextColorIndex": 14
} }

View File

@ -15,7 +15,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleClient", "Simple\Simp
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleServer", "Simple\SimpleServer\SimpleServer.csproj", "{5559B94A-DA9E-4CF7-B799-2BCAA1F11F49}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleServer", "Simple\SimpleServer\SimpleServer.csproj", "{5559B94A-DA9E-4CF7-B799-2BCAA1F11F49}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HaoYueNet.ClientNetworkNet4x", "NetLib\HaoYueNet.ClientNetworkNet4x\HaoYueNet.ClientNetworkNet4x.csproj", "{27E139E2-F5F5-47DF-99D8-04DC7EBEBEEC}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HaoYueNet.ClientNetworkNet4x", "NetLib\HaoYueNet.ClientNetworkNet4x\HaoYueNet.ClientNetworkNet4x.csproj", "{A741610F-29B9-4F0E-9A3D-0B3E1318F031}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -39,10 +39,10 @@ Global
{5559B94A-DA9E-4CF7-B799-2BCAA1F11F49}.Debug|Any CPU.Build.0 = Debug|Any CPU {5559B94A-DA9E-4CF7-B799-2BCAA1F11F49}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5559B94A-DA9E-4CF7-B799-2BCAA1F11F49}.Release|Any CPU.ActiveCfg = Release|Any CPU {5559B94A-DA9E-4CF7-B799-2BCAA1F11F49}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5559B94A-DA9E-4CF7-B799-2BCAA1F11F49}.Release|Any CPU.Build.0 = Release|Any CPU {5559B94A-DA9E-4CF7-B799-2BCAA1F11F49}.Release|Any CPU.Build.0 = Release|Any CPU
{27E139E2-F5F5-47DF-99D8-04DC7EBEBEEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A741610F-29B9-4F0E-9A3D-0B3E1318F031}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{27E139E2-F5F5-47DF-99D8-04DC7EBEBEEC}.Debug|Any CPU.Build.0 = Debug|Any CPU {A741610F-29B9-4F0E-9A3D-0B3E1318F031}.Debug|Any CPU.Build.0 = Debug|Any CPU
{27E139E2-F5F5-47DF-99D8-04DC7EBEBEEC}.Release|Any CPU.ActiveCfg = Release|Any CPU {A741610F-29B9-4F0E-9A3D-0B3E1318F031}.Release|Any CPU.ActiveCfg = Release|Any CPU
{27E139E2-F5F5-47DF-99D8-04DC7EBEBEEC}.Release|Any CPU.Build.0 = Release|Any CPU {A741610F-29B9-4F0E-9A3D-0B3E1318F031}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -52,7 +52,7 @@ Global
{696F6AAE-2D41-48F7-8FCD-E95CFE2A6519} = {D0066C06-A89A-4E05-80E0-D8232FB0FF3C} {696F6AAE-2D41-48F7-8FCD-E95CFE2A6519} = {D0066C06-A89A-4E05-80E0-D8232FB0FF3C}
{C558ACA4-E59E-4F4D-94B7-2B78DA272CF3} = {A2CAD164-0816-4D1D-9793-1B1F398C9D29} {C558ACA4-E59E-4F4D-94B7-2B78DA272CF3} = {A2CAD164-0816-4D1D-9793-1B1F398C9D29}
{5559B94A-DA9E-4CF7-B799-2BCAA1F11F49} = {A2CAD164-0816-4D1D-9793-1B1F398C9D29} {5559B94A-DA9E-4CF7-B799-2BCAA1F11F49} = {A2CAD164-0816-4D1D-9793-1B1F398C9D29}
{27E139E2-F5F5-47DF-99D8-04DC7EBEBEEC} = {D0066C06-A89A-4E05-80E0-D8232FB0FF3C} {A741610F-29B9-4F0E-9A3D-0B3E1318F031} = {D0066C06-A89A-4E05-80E0-D8232FB0FF3C}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {22107F03-013F-4871-AC8E-F082694E2679} SolutionGuid = {22107F03-013F-4871-AC8E-F082694E2679}

View File

@ -210,9 +210,9 @@ namespace HaoYueNet.ClientNetwork
LogOut("关闭心跳包计数"); LogOut("关闭心跳包计数");
_heartTimer.Enabled = false; _heartTimer.Enabled = false;
LogOut("关闭连接"); LogOut("关闭连接");
OnClose();
//关闭Socket连接 //关闭Socket连接
client.Close(); client.Close();
OnClose();
} }

View File

@ -4,14 +4,15 @@
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{27E139E2-F5F5-47DF-99D8-04DC7EBEBEEC}</ProjectGuid> <ProjectGuid>{A741610F-29B9-4F0E-9A3D-0B3E1318F031}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>HaoYueNet.ClientNetworkNet4x</RootNamespace> <RootNamespace>HaoYueNet.ClientNetworkNet4x</RootNamespace>
<AssemblyName>HaoYueNet.ClientNetworkNet4x</AssemblyName> <AssemblyName>HaoYueNet.ClientNetworkNet4x</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic> <Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@ -31,30 +32,12 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="protobuf-net, Version=3.0.0.0, Culture=neutral, PublicKeyToken=257b51d87d2e4d67, processorArchitecture=MSIL"> <Reference Include="protobuf-net, Version=2.4.0.0, Culture=neutral, PublicKeyToken=257b51d87d2e4d67, processorArchitecture=MSIL">
<HintPath>..\..\packages\protobuf-net.3.0.101\lib\net461\protobuf-net.dll</HintPath> <SpecificVersion>False</SpecificVersion>
</Reference> <HintPath>.\protobuf-net.dll</HintPath>
<Reference Include="protobuf-net.Core, Version=3.0.0.0, Culture=neutral, PublicKeyToken=257b51d87d2e4d67, processorArchitecture=MSIL">
<HintPath>..\..\packages\protobuf-net.Core.3.0.101\lib\net461\protobuf-net.Core.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Collections.Immutable, Version=1.2.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Collections.Immutable.1.7.1\lib\net461\System.Collections.Immutable.dll</HintPath>
</Reference>
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
@ -68,7 +51,7 @@
<Compile Include="protobuf_HunterNetCore.cs" /> <Compile Include="protobuf_HunterNetCore.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="packages.config" /> <Content Include="protobuf-net.dll" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

View File

@ -210,9 +210,9 @@ namespace HaoYueNet.ClientNetworkNet4x
LogOut("关闭心跳包计数"); LogOut("关闭心跳包计数");
_heartTimer.Enabled = false; _heartTimer.Enabled = false;
LogOut("关闭连接"); LogOut("关闭连接");
OnClose();
//关闭Socket连接 //关闭Socket连接
client.Close(); client.Close();
OnClose();
} }

View File

@ -20,7 +20,7 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("27e139e2-f5f5-47df-99d8-04dc7ebebeec")] [assembly: Guid("a741610f-29b9-4f0e-9a3d-0b3e1318f031")]
// 程序集的版本信息由下列四个值组成: // 程序集的版本信息由下列四个值组成:
// //

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="protobuf-net" version="3.0.101" targetFramework="net48" />
<package id="protobuf-net.Core" version="3.0.101" targetFramework="net48" />
<package id="System.Buffers" version="4.5.1" targetFramework="net48" />
<package id="System.Collections.Immutable" version="1.7.1" targetFramework="net48" />
<package id="System.Memory" version="4.5.4" targetFramework="net48" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net48" />
</packages>

Binary file not shown.

View File

@ -17,7 +17,7 @@ namespace SimpleClient
//指定接收服务器数据事件 //指定接收服务器数据事件
OnDataCallBack += GetDataCallBack; OnDataCallBack += GetDataCallBack;
//断开连接 //断开连接
OnClose += Close; OnClose += OnConnectClose;
//网络库调试信息输出事件,用于打印连接断开,收发事件 //网络库调试信息输出事件,用于打印连接断开,收发事件
OnLogOut += NetworkDeBugLog; OnLogOut += NetworkDeBugLog;
OnConnected += NetworkConnected; OnConnected += NetworkConnected;
@ -50,9 +50,8 @@ namespace SimpleClient
/// <param name="ERRCODE">错误编号</param> /// <param name="ERRCODE">错误编号</param>
/// <param name="data">业务数据</param> /// <param name="data">业务数据</param>
public void GetDataCallBack(int CMDID, int ERRCODE, byte[] data) public void GetDataCallBack(int CMDID, int ERRCODE, byte[] data)
{ {
Console.WriteLine("收到消息 CMDID =>" + CMDID + " ERRCODE =>" + ERRCODE + " 数据长度=>" + data.Length); NetworkDeBugLog("收到消息 CMDID =>" + CMDID + " ERRCODE =>" + ERRCODE + " 数据长度=>" + data.Length);
try try
{ {
@ -63,7 +62,7 @@ namespace SimpleClient
} }
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine("逻辑处理错误:" + ex.ToString()); NetworkDeBugLog("逻辑处理错误:" + ex.ToString());
} }
} }
@ -71,9 +70,9 @@ namespace SimpleClient
/// <summary> /// <summary>
/// 关闭连接 /// 关闭连接
/// </summary> /// </summary>
public void Close() public void OnConnectClose()
{ {
Console.WriteLine("断开连接"); NetworkDeBugLog("OnConnectClose");
} }
} }
} }