diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b53633c..4a423df 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,16 +1,37 @@ +# This is a basic workflow to help you get started with Actions name: CI -on: [push] +# Controls when the workflow will run +on: + push: + pull_request: + workflow_dispatch: +# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: + # This workflow contains a single job called "build" build: - + # The type of runner that the job will run on runs-on: windows-latest + defaults: + run: + working-directory: ./src + + # Steps represent a sequence of tasks that will be executed as part of the job steps: - - uses: actions/checkout@v1 - - name: MSBuild - run: | - cd "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\" - .\MSBuild.exe $Env:GITHUB_WORKSPACE\src\HiSocket.sln + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + # Runs a single command using the runners shell + - name: Hello world + run: echo Hello, world! + + - name: Setup .NET SDK + uses: actions/setup-dotnet@v1.7.2 + with: + dotnet-version: 5.0.x + + - name: Build + run: dotnet build --configuration Release diff --git a/.gitignore b/.gitignore index 409b97a..e3a6880 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .vs -TestResults +bin +obj diff --git a/src/HiSocket.Tcp/obj/Debug/netstandard2.0/HiSocket.Tcp.csproj.CopyComplete b/.gitkeep similarity index 100% rename from src/HiSocket.Tcp/obj/Debug/netstandard2.0/HiSocket.Tcp.csproj.CopyComplete rename to .gitkeep diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 10a4163..0000000 --- a/.travis.yml +++ /dev/null @@ -1,2 +0,0 @@ -language: csharp -solution: ./src/HiSocket.sln \ No newline at end of file diff --git a/README.md b/README.md index b962428..da3c62a 100644 --- a/README.md +++ b/README.md @@ -3,15 +3,15 @@ It is a lightweight client socket solution, you can used it in Unity3d or C# project -![Packagist](https://img.shields.io/packagist/l/doctrine/orm.svg) ![](https://github.com/hiramtan/hisocket/workflows/CI/badge.svg?branch=master) [![Build Status](https://travis-ci.org/hiramtan/HiSocket.svg?branch=master)](https://travis-ci.org/hiramtan/HiSocket) [![GitHub release](https://img.shields.io/github/release/hiramtan/HiSocket.svg)](https://github.com/hiramtan/HiSocket/releases) +![Packagist](https://img.shields.io/packagist/l/doctrine/orm.svg) ![](https://github.com/hiramtan/hisocket/workflows/CI/badge.svg?branch=master) [![GitHub release](https://img.shields.io/github/release/hiramtan/HiSocket.svg)](https://github.com/hiramtan/HiSocket/releases) [![Github Releases](https://img.shields.io/github/downloads/atom/atom/total.svg)](https://github.com/hiramtan/HiSocket/releases) ----- -[中文说明](https://github.com/hiramtan/HiSocket/blob/master/README_zh.md) +[中文说明](https://github.com/hiram3512/HiSocket/blob/master/README_zh.md) ### How to use - Use source code: [source code](/src) -- Download dll from release path: [![Github Releases](https://img.shields.io/github/downloads/atom/atom/total.svg)](https://github.com/hiramtan/HiSocket/releases) +- Download dll from release path: [Github Releases](https://github.com/hiramtan/HiSocket/releases) - Use Nuget: [HiSocket NuGet package](https://www.nuget.org/packages/HiSocket) Quick Start: @@ -69,7 +69,6 @@ This project contains: - Support protobuf message - AES encryption - ### Details - Use async connection in main thread(avoid thread blocking). - Using [Circular_buffer](https://en.wikipedia.org/wiki/Circular_buffer) to avoid memory allocation every time, and reduce garbage collection. @@ -77,6 +76,8 @@ This project contains: - If you use Tcp socket, you should implement IPackage interface to pack or unpack message. - Ping: there is a ping plugin you can used, but if you are used in unity3d because of the bug of mono, it will throw an error on .net2.0(.net 4.6 will be fine, also you can use unity's api to get ping time) +### Framework +![framework](/others/fwsZp3Arrs.png) ### Advanced - If you are clear about socket, you also can use TcpSocket to achieve your logic, anyway the recommend is TcpConnection. @@ -88,7 +89,6 @@ This project contains: - The encryption is use AES, if you want to use encryption you can use the API to encrypte your bytes. - .etc - ### Instructions - Tcp [Transmission Control Protocol](https://en.wikipedia.org/wiki/Transmission_Control_Protocol) diff --git a/README_zh.md b/README_zh.md index af7a871..469a385 100644 --- a/README_zh.md +++ b/README_zh.md @@ -2,14 +2,14 @@ 客户端轻量Socket通信逻辑,可以在C#项目或Unity3d项目中使用. -![Packagist](https://img.shields.io/packagist/l/doctrine/orm.svg) [![Build Status](https://travis-ci.org/hiramtan/HiSocket.svg?branch=master)](https://travis-ci.org/hiramtan/HiSocket) [![GitHub release](https://img.shields.io/github/release/hiramtan/HiSocket.svg)](https://github.com/hiramtan/HiSocket/releases) +![Packagist](https://img.shields.io/packagist/l/doctrine/orm.svg) ![](https://github.com/hiramtan/hisocket/workflows/CI/badge.svg?branch=master) [![GitHub release](https://img.shields.io/github/release/hiramtan/HiSocket.svg)](https://github.com/hiramtan/HiSocket/releases) [![Github Releases](https://img.shields.io/github/downloads/atom/atom/total.svg)](https://github.com/hiramtan/HiSocket/releases) ----- ### 如何使用 - 使用源码: [source code](/src) -- 发布页下载dll: [![Github Releases](https://img.shields.io/github/downloads/atom/atom/total.svg)](https://github.com/hiramtan/HiSocket/releases) +- 发布页下载dll: [Github Releases](https://github.com/hiramtan/HiSocket/releases) - 使用 Nuget: [HiSocket NuGet package](https://www.nuget.org/packages/HiSocket) @@ -74,6 +74,9 @@ - 如果使用Tcp协议需要实现IPackage接口处理粘包拆包. - Ping: 源码包含一个Ping插件可以使用,但是如果用在unity3d工程中会报错(因为mono的问题,在.net2.0会报错.net4.6可以正常使用) +### 结构 +![framework](/others/fwsZp3Arrs.png) + ### 高级功能 - 如果对Socket很熟悉,也可以使用TcpSocket来实现功能,但是还是推荐使用TcpConnection的方式. - 通过接口可以访问底层Socket对象扩展逻辑,比如修改超时时间. diff --git a/others/fwsZp3Arrs.png b/others/fwsZp3Arrs.png new file mode 100644 index 0000000..e681021 Binary files /dev/null and b/others/fwsZp3Arrs.png differ diff --git a/src/HiSocket.Tcp.Example/ExamplePackage1.cs b/src/HiSocket.Tcp.Example/ExamplePackage1.cs new file mode 100644 index 0000000..7144317 --- /dev/null +++ b/src/HiSocket.Tcp.Example/ExamplePackage1.cs @@ -0,0 +1,30 @@ +/*************************************************************** + * Description: Block buffer for reuse array + * + * Documents: https://github.com/hiram3512/HiSocket + * Support: hiramtan@live.com +***************************************************************/ + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Text; + +namespace HiSocket.Tcp.Example +{ + public class ExamplePackage1 : IPackage + { + public void Pack(byte[] message, IBlockBuffer sendBuffer) + { + sendBuffer.WriteAtEnd(message); + } + public void Unpack(IBlockBuffer receiveBuffer, ref byte[] message) + { + var length = receiveBuffer.Index; + if (length > 0) + { + message = receiveBuffer.ReadFromHead(length); + } + } + } +} \ No newline at end of file diff --git a/src/HiSocket.Tcp.Example/ExamplePackage2.cs b/src/HiSocket.Tcp.Example/ExamplePackage2.cs new file mode 100644 index 0000000..03428c7 --- /dev/null +++ b/src/HiSocket.Tcp.Example/ExamplePackage2.cs @@ -0,0 +1,39 @@ +/*************************************************************** + * Description: Block buffer for reuse array + * + * Documents: https://github.com/hiram3512/HiSocket + * Support: hiramtan@live.com +***************************************************************/ + +using System; +using System.Collections.Generic; +using System.Text; + +namespace HiSocket.Tcp.Example +{ + public class ExamplePackage2 : IPackage + { + public void Pack(byte[] message, IBlockBuffer sendBuffer) + { + //消息头,假设用int标识,4字节 + int length = message.Length; + byte[] lengthBytes = BitConverter.GetBytes(length); + sendBuffer.WriteAtEnd(lengthBytes); + sendBuffer.WriteAtEnd(message); + } + public void Unpack(IBlockBuffer receiveBuffer, ref byte[] message) + { + //消息头,假设用int标识,4字节 + if (receiveBuffer.Index >= 4) + { + byte[] lengthBytes = receiveBuffer.TryReadFromHead(4); + int length = BitConverter.ToInt32(lengthBytes, 0); + if (receiveBuffer.Index >= length)//buffer中有足够数据 + { + receiveBuffer.IncreaseIndex(4);//消息头,假设用int标识,4字节,开始读取消息体 + message = receiveBuffer.ReadFromHead(length); + } + } + } + } +} diff --git a/src/HiSocket.Tcp.Example/ExampleTcpConnection1.cs b/src/HiSocket.Tcp.Example/ExampleTcpConnection1.cs new file mode 100644 index 0000000..a7c6417 --- /dev/null +++ b/src/HiSocket.Tcp.Example/ExampleTcpConnection1.cs @@ -0,0 +1,40 @@ +/*************************************************************** + * Description: Block buffer for reuse array + * + * Documents: https://github.com/hiram3512/HiSocket + * Support: hiramtan@live.com +***************************************************************/ + +using System; +using HiSocket; + +namespace HiSocket.Tcp.Example +{ + public class ExampleTcpConnection1 + { + private TcpConnection tcpConnection; + void Main() + { + var package = new ExamplePackage2(); + tcpConnection = new TcpConnection(package); + tcpConnection.OnConnecting += OnConnecting; + tcpConnection.OnConnected += OnConnected; + tcpConnection.OnReceiveMessage += OnReceiveMessage; + tcpConnection.Connect("127.0.0.1", 999); + } + void OnConnecting() + { + Console.WriteLine("Connecting"); + } + void OnConnected() + { + Console.WriteLine("Connected"); + var data = new byte[] { 1, 2, 3 }; + tcpConnection.Send(data); + } + void OnReceiveMessage(byte[] data) + { + Console.WriteLine("Receive data"); + } + } +} diff --git a/src/HiSocket.Tcp.Example/ExampleTcpConnection2.cs b/src/HiSocket.Tcp.Example/ExampleTcpConnection2.cs new file mode 100644 index 0000000..3668e0a --- /dev/null +++ b/src/HiSocket.Tcp.Example/ExampleTcpConnection2.cs @@ -0,0 +1,45 @@ +/*************************************************************** + * Description: Block buffer for reuse array + * + * Documents: https://github.com/hiram3512/HiSocket + * Support: hiramtan@live.com +***************************************************************/ + +using System; +using System.Collections.Generic; +using System.Text; + +namespace HiSocket.Tcp.Example +{ + public class ExampleTcpConnection2 + { + private TcpConnection tcpConnection; + void Main() + { + var package = new ExamplePackage2(); + tcpConnection = new TcpConnection(package); + tcpConnection.OnConnected += OnConnected; + tcpConnection.OnReceiveMessage += OnReceiveMessage; + tcpConnection.OnException += OnException; + tcpConnection.Connect("127.0.0.1", 999); + tcpConnection.Socket.NoDelay = true; + tcpConnection.Socket.SendTimeout = 100; + tcpConnection.Socket.ReceiveTimeout = 200; + } + + void OnConnected() + { + Console.WriteLine("Connected"); + var data = new byte[] { 1, 2, 3 }; + tcpConnection.Send(data); + } + void OnReceiveMessage(byte[] data) + { + Console.WriteLine("Receive data"); + } + void OnException(Exception e) + { + Console.WriteLine(e.ToString()); + } + } +} diff --git a/src/HiSocket.Tcp.Example/HiSocket.Tcp.Example.csproj b/src/HiSocket.Tcp.Example/HiSocket.Tcp.Example.csproj new file mode 100644 index 0000000..730fc41 --- /dev/null +++ b/src/HiSocket.Tcp.Example/HiSocket.Tcp.Example.csproj @@ -0,0 +1,11 @@ + + + + netstandard2.0 + + + + + + + diff --git a/src/HiSocket.Tcp.Test/HiSocket.Tcp.Test.csproj b/src/HiSocket.Tcp.Test/HiSocket.Tcp.Test.csproj new file mode 100644 index 0000000..be218bc --- /dev/null +++ b/src/HiSocket.Tcp.Test/HiSocket.Tcp.Test.csproj @@ -0,0 +1,21 @@ + + + + net5.0 + + false + + + + + + + + + + + + + + + diff --git a/src/HiSocket.Tcp.Test/TcpConnectionTests.cs b/src/HiSocket.Tcp.Test/TcpConnectionTests.cs new file mode 100644 index 0000000..a4159c0 --- /dev/null +++ b/src/HiSocket.Tcp.Test/TcpConnectionTests.cs @@ -0,0 +1,83 @@ +/*************************************************************** + * Description: Block buffer for reuse array + * + * Documents: https://github.com/hiram3512/HiSocket + * Support: hiramtan@live.com +***************************************************************/ + +using Microsoft.VisualStudio.TestTools.UnitTesting; +using HiSocket.Tcp; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Net; +using System.Threading; + +namespace HiSocket.Tcp.Test +{ + [TestClass()] + public class TcpConnectionTests + { + private TestServer server; + + [TestInitialize] + public void Init() + { + server = new TestServer(); + } + + [TestCleanup] + public void Cleanup() + { + server.Close(); + server = null; + } + + [TestMethod()] + public void SendTest() + { + AutoResetEvent evt = new AutoResetEvent(false); + byte[] byte1 = new byte[] { 1 }; + byte[] byte2 = null; + var package = new Example.ExamplePackage2(); + var tcp = new TcpConnection(package); + tcp.OnSendMessage += (data) => + { + byte2 = data; + evt.Set(); + }; + tcp.OnConnected += () => + { + tcp.Send(byte1); + }; + tcp.Connect("127.0.0.1", 999); + evt.WaitOne(); + Assert.AreEqual(byte1[0], byte2[0]); + } + + [TestMethod()] + public void ReceiveTest() + { + AutoResetEvent evt = new AutoResetEvent(false); + byte[] byte1 = new byte[] { 1 }; + byte[] byte2 = null; + var package = new Example.ExamplePackage2(); + var tcp = new TcpConnection(package); + tcp.OnReceiveMessage += (data) => + { + byte2 = data; + evt.Set(); + }; + + tcp.OnConnected += () => + { + tcp.Send(byte1); + }; + tcp.Connect("127.0.0.1", 999); + evt.WaitOne(); + Assert.AreEqual(byte1[0], byte2[0]); + } + } +} \ No newline at end of file diff --git a/src/HiSocket.Tcp.Test/TcpSocketTests.cs b/src/HiSocket.Tcp.Test/TcpSocketTests.cs new file mode 100644 index 0000000..512c5ee --- /dev/null +++ b/src/HiSocket.Tcp.Test/TcpSocketTests.cs @@ -0,0 +1,147 @@ +/*************************************************************** + * Description: Block buffer for reuse array + * + * Documents: https://github.com/hiram3512/HiSocket + * Support: hiramtan@live.com +***************************************************************/ + +using Microsoft.VisualStudio.TestTools.UnitTesting; +using HiSocket.Tcp; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Net; +using System.Threading; + +namespace HiSocket.Tcp.Test +{ + [TestClass()] + public class TcpSocketTests + { + private TestServer server; + + [TestInitialize] + public void Init() + { + server = new TestServer(); + } + + [TestCleanup] + public void Cleanup() + { + server.Close(); + server = null; + } + + [TestMethod()] + public void TcpSocketTest() + { + var tcp1 = new TcpSocket(); + Assert.IsNotNull(tcp1); + var tcp2 = new TcpSocket(1024); + Assert.IsNotNull(tcp2); + } + + [TestMethod()] + public void ConnectTest() + { + AutoResetEvent evt = new AutoResetEvent(false); + var isConnected = false; + var isConnecting = false; + var tcp = new TcpSocket(); + tcp.OnConnecting += () => + { + isConnecting = true; + }; + tcp.OnConnected += () => + { + isConnected = true; + evt.Set(); + }; + tcp.OnDisconnected += () => + { + isConnected = false; + evt.Set(); + }; + tcp.Connect("127.0.0.1", 999); + evt.WaitOne(); + Assert.IsTrue(isConnecting); + Assert.IsTrue(isConnected); + + tcp.Disconnect(); + evt.WaitOne(); + Assert.IsFalse(isConnected); + } + + [TestMethod()] + public void SendBytesTest() + { + AutoResetEvent evt = new AutoResetEvent(false); + byte[] byte1 = new byte[] { 123 }; + byte[] byte2 = null; + var tcp = new TcpSocket(); + tcp.OnSendBytes += (data) => + { + byte2 = data; + evt.Set(); + }; + tcp.OnConnected += () => + { + tcp.SendBytes(byte1); + }; + tcp.Connect("127.0.0.1", 999); + evt.WaitOne(); + Assert.AreEqual(byte1[0], byte2[0]); + } + + [TestMethod()] + public void ReceiveBytesTest() + { + AutoResetEvent evt = new AutoResetEvent(false); + byte[] byte1 = new byte[] { 1, 2 }; + byte[] byte2 = null; + var tcp = new TcpSocket(); + tcp.OnReceiveBytes += (buffer) => + { + var receiveLength = buffer.Index; + byte2 = buffer.ReadFromHead(receiveLength); + evt.Set(); + }; + tcp.OnConnected += () => + { + tcp.SendBytes(byte1); + }; + tcp.Connect("127.0.0.1", 999); + evt.WaitOne(); + Assert.AreEqual(byte1[0], byte2[0]); + Assert.AreEqual(byte1[1], byte2[1]); + } + + [TestMethod()] + public void DisposeTest() + { + var tcp = new TcpSocket(); + tcp.Dispose(); + Assert.IsNull(tcp.SendBuffer); + Assert.IsNull(tcp.ReceiveBuffer); + } + + [TestMethod()] + public void ExceptionTest() + { + AutoResetEvent evt = new AutoResetEvent(false); + Exception testException = null; + var tcp = new TcpSocket(); + tcp.OnException += (e) => + { + testException = e; + evt.Set(); + }; + tcp.Connect("123", 999); + evt.WaitOne(); + Assert.IsNotNull(testException); + } + } +} \ No newline at end of file diff --git a/src/HiSocket.Tcp.Test/TestServer.cs b/src/HiSocket.Tcp.Test/TestServer.cs new file mode 100644 index 0000000..d05f2ac --- /dev/null +++ b/src/HiSocket.Tcp.Test/TestServer.cs @@ -0,0 +1,52 @@ +/*************************************************************** + * Description: Block buffer for reuse array + * + * Documents: https://github.com/hiram3512/HiSocket + * Support: hiramtan@live.com +***************************************************************/ + +using System; +using System.Net; +using System.Net.Sockets; +using System.Threading; + +namespace HiSocket.Tcp.Test +{ + public class TestServer + { + private Socket socket; + private bool isOn = true; + public TestServer() + { + IPEndPoint iep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 999); + socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + socket.Bind(iep); + socket.Listen(5); + socket.NoDelay = true; + new Thread(Watcher).Start(); + } + void Watcher() + { + byte[] buffer = new byte[1 << 16]; + while (isOn) + { + var client = socket.Accept(); + int length = 0; + while ((length = client.Receive(buffer)) > 0) + { + byte[] toSend = new byte[length]; + Array.Copy(buffer, 0, toSend, 0, toSend.Length); + Console.WriteLine(toSend.Length); + client.Send(toSend); + } + } + } + + public void Close() + { + isOn = false; + socket.Close(); + socket = null; + } + } +} diff --git a/src/HiSocket.Tcp.TestServer/HiSocket.Tcp.TestServer.csproj b/src/HiSocket.Tcp.TestServer/HiSocket.Tcp.TestServer.csproj deleted file mode 100644 index 2082704..0000000 --- a/src/HiSocket.Tcp.TestServer/HiSocket.Tcp.TestServer.csproj +++ /dev/null @@ -1,8 +0,0 @@ - - - - Exe - net5.0 - - - diff --git a/src/HiSocket.Tcp.TestServer/Program.cs b/src/HiSocket.Tcp.TestServer/Program.cs deleted file mode 100644 index 1badbdb..0000000 --- a/src/HiSocket.Tcp.TestServer/Program.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace HiSocket.Tcp.TestServer -{ - class Program - { - static void Main(string[] args) - { - Console.WriteLine("Hello World!"); - } - } -} diff --git a/src/HiSocket.Tcp.TestServer/obj/Debug/net5.0/.NETCoreApp,Version=v5.0.AssemblyAttributes.cs b/src/HiSocket.Tcp.TestServer/obj/Debug/net5.0/.NETCoreApp,Version=v5.0.AssemblyAttributes.cs deleted file mode 100644 index 2f7e5ec..0000000 --- a/src/HiSocket.Tcp.TestServer/obj/Debug/net5.0/.NETCoreApp,Version=v5.0.AssemblyAttributes.cs +++ /dev/null @@ -1,4 +0,0 @@ -// -using System; -using System.Reflection; -[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v5.0", FrameworkDisplayName = "")] diff --git a/src/HiSocket.Tcp.TestServer/obj/Debug/net5.0/HiSocket.Tcp.TestServer.AssemblyInfo.cs b/src/HiSocket.Tcp.TestServer/obj/Debug/net5.0/HiSocket.Tcp.TestServer.AssemblyInfo.cs deleted file mode 100644 index 114a26c..0000000 --- a/src/HiSocket.Tcp.TestServer/obj/Debug/net5.0/HiSocket.Tcp.TestServer.AssemblyInfo.cs +++ /dev/null @@ -1,23 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -using System; -using System.Reflection; - -[assembly: System.Reflection.AssemblyCompanyAttribute("HiSocket.Tcp.TestServer")] -[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] -[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] -[assembly: System.Reflection.AssemblyProductAttribute("HiSocket.Tcp.TestServer")] -[assembly: System.Reflection.AssemblyTitleAttribute("HiSocket.Tcp.TestServer")] -[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] - -// Generated by the MSBuild WriteCodeFragment class. - diff --git a/src/HiSocket.Tcp.TestServer/obj/Debug/net5.0/HiSocket.Tcp.TestServer.AssemblyInfoInputs.cache b/src/HiSocket.Tcp.TestServer/obj/Debug/net5.0/HiSocket.Tcp.TestServer.AssemblyInfoInputs.cache deleted file mode 100644 index e0e4cf6..0000000 --- a/src/HiSocket.Tcp.TestServer/obj/Debug/net5.0/HiSocket.Tcp.TestServer.AssemblyInfoInputs.cache +++ /dev/null @@ -1 +0,0 @@ -3e9f10230fc875a41965953f1b816f8cd12062db diff --git a/src/HiSocket.Tcp.TestServer/obj/Debug/net5.0/HiSocket.Tcp.TestServer.GeneratedMSBuildEditorConfig.editorconfig b/src/HiSocket.Tcp.TestServer/obj/Debug/net5.0/HiSocket.Tcp.TestServer.GeneratedMSBuildEditorConfig.editorconfig deleted file mode 100644 index 2c605ef..0000000 --- a/src/HiSocket.Tcp.TestServer/obj/Debug/net5.0/HiSocket.Tcp.TestServer.GeneratedMSBuildEditorConfig.editorconfig +++ /dev/null @@ -1,10 +0,0 @@ -is_global = true -build_property.TargetFramework = net5.0 -build_property.TargetPlatformMinVersion = -build_property.UsingMicrosoftNETSdkWeb = -build_property.ProjectTypeGuids = -build_property.PublishSingleFile = -build_property.IncludeAllContentForSelfExtract = -build_property._SupportedPlatformList = Android,iOS,Linux,macOS,Windows -build_property.RootNamespace = HiSocket.Tcp.TestServer -build_property.ProjectDir = D:\HiGit\GitHub\HiSocket\src\HiSocket.Tcp.TestServer\ diff --git a/src/HiSocket.Tcp.TestServer/obj/Debug/net5.0/HiSocket.Tcp.TestServer.assets.cache b/src/HiSocket.Tcp.TestServer/obj/Debug/net5.0/HiSocket.Tcp.TestServer.assets.cache deleted file mode 100644 index 9c4deb9..0000000 Binary files a/src/HiSocket.Tcp.TestServer/obj/Debug/net5.0/HiSocket.Tcp.TestServer.assets.cache and /dev/null differ diff --git a/src/HiSocket.Tcp.TestServer/obj/Debug/net5.0/HiSocket.Tcp.TestServer.csproj.AssemblyReference.cache b/src/HiSocket.Tcp.TestServer/obj/Debug/net5.0/HiSocket.Tcp.TestServer.csproj.AssemblyReference.cache deleted file mode 100644 index 22a214f..0000000 Binary files a/src/HiSocket.Tcp.TestServer/obj/Debug/net5.0/HiSocket.Tcp.TestServer.csproj.AssemblyReference.cache and /dev/null differ diff --git a/src/HiSocket.Tcp.TestServer/obj/HiSocket.Tcp.TestServer.csproj.nuget.dgspec.json b/src/HiSocket.Tcp.TestServer/obj/HiSocket.Tcp.TestServer.csproj.nuget.dgspec.json deleted file mode 100644 index 164f16f..0000000 --- a/src/HiSocket.Tcp.TestServer/obj/HiSocket.Tcp.TestServer.csproj.nuget.dgspec.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "format": 1, - "restore": { - "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Tcp.TestServer\\HiSocket.Tcp.TestServer.csproj": {} - }, - "projects": { - "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Tcp.TestServer\\HiSocket.Tcp.TestServer.csproj": { - "version": "1.0.0", - "restore": { - "projectUniqueName": "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Tcp.TestServer\\HiSocket.Tcp.TestServer.csproj", - "projectName": "HiSocket.Tcp.TestServer", - "projectPath": "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Tcp.TestServer\\HiSocket.Tcp.TestServer.csproj", - "packagesPath": "C:\\Users\\hiramtan\\.nuget\\packages\\", - "outputPath": "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Tcp.TestServer\\obj\\", - "projectStyle": "PackageReference", - "fallbackFolders": [ - "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" - ], - "configFilePaths": [ - "C:\\Users\\hiramtan\\AppData\\Roaming\\NuGet\\NuGet.Config", - "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config", - "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" - ], - "originalTargetFrameworks": [ - "net5.0" - ], - "sources": { - "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, - "https://api.nuget.org/v3/index.json": {} - }, - "frameworks": { - "net5.0": { - "targetAlias": "net5.0", - "projectReferences": {} - } - }, - "warningProperties": { - "warnAsError": [ - "NU1605" - ] - } - }, - "frameworks": { - "net5.0": { - "targetAlias": "net5.0", - "imports": [ - "net461", - "net462", - "net47", - "net471", - "net472", - "net48" - ], - "assetTargetFallback": true, - "warn": true, - "frameworkReferences": { - "Microsoft.NETCore.App": { - "privateAssets": "all" - } - }, - "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.402\\RuntimeIdentifierGraph.json" - } - } - } - } -} \ No newline at end of file diff --git a/src/HiSocket.Tcp.TestServer/obj/HiSocket.Tcp.TestServer.csproj.nuget.g.props b/src/HiSocket.Tcp.TestServer/obj/HiSocket.Tcp.TestServer.csproj.nuget.g.props deleted file mode 100644 index 59f2fb5..0000000 --- a/src/HiSocket.Tcp.TestServer/obj/HiSocket.Tcp.TestServer.csproj.nuget.g.props +++ /dev/null @@ -1,19 +0,0 @@ - - - - True - NuGet - $(MSBuildThisFileDirectory)project.assets.json - $(UserProfile)\.nuget\packages\ - C:\Users\hiramtan\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages - PackageReference - 5.11.1 - - - - - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - - \ No newline at end of file diff --git a/src/HiSocket.Tcp.TestServer/obj/HiSocket.Tcp.TestServer.csproj.nuget.g.targets b/src/HiSocket.Tcp.TestServer/obj/HiSocket.Tcp.TestServer.csproj.nuget.g.targets deleted file mode 100644 index 53cfaa1..0000000 --- a/src/HiSocket.Tcp.TestServer/obj/HiSocket.Tcp.TestServer.csproj.nuget.g.targets +++ /dev/null @@ -1,6 +0,0 @@ - - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - - \ No newline at end of file diff --git a/src/HiSocket.Tcp.TestServer/obj/project.assets.json b/src/HiSocket.Tcp.TestServer/obj/project.assets.json deleted file mode 100644 index 8d43fc0..0000000 --- a/src/HiSocket.Tcp.TestServer/obj/project.assets.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "version": 3, - "targets": { - "net5.0": {} - }, - "libraries": {}, - "projectFileDependencyGroups": { - "net5.0": [] - }, - "packageFolders": { - "C:\\Users\\hiramtan\\.nuget\\packages\\": {}, - "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages": {} - }, - "project": { - "version": "1.0.0", - "restore": { - "projectUniqueName": "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Tcp.TestServer\\HiSocket.Tcp.TestServer.csproj", - "projectName": "HiSocket.Tcp.TestServer", - "projectPath": "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Tcp.TestServer\\HiSocket.Tcp.TestServer.csproj", - "packagesPath": "C:\\Users\\hiramtan\\.nuget\\packages\\", - "outputPath": "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Tcp.TestServer\\obj\\", - "projectStyle": "PackageReference", - "fallbackFolders": [ - "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" - ], - "configFilePaths": [ - "C:\\Users\\hiramtan\\AppData\\Roaming\\NuGet\\NuGet.Config", - "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config", - "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" - ], - "originalTargetFrameworks": [ - "net5.0" - ], - "sources": { - "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, - "https://api.nuget.org/v3/index.json": {} - }, - "frameworks": { - "net5.0": { - "targetAlias": "net5.0", - "projectReferences": {} - } - }, - "warningProperties": { - "warnAsError": [ - "NU1605" - ] - } - }, - "frameworks": { - "net5.0": { - "targetAlias": "net5.0", - "imports": [ - "net461", - "net462", - "net47", - "net471", - "net472", - "net48" - ], - "assetTargetFallback": true, - "warn": true, - "frameworkReferences": { - "Microsoft.NETCore.App": { - "privateAssets": "all" - } - }, - "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.402\\RuntimeIdentifierGraph.json" - } - } - } -} \ No newline at end of file diff --git a/src/HiSocket.Tcp.TestServer/obj/project.nuget.cache b/src/HiSocket.Tcp.TestServer/obj/project.nuget.cache deleted file mode 100644 index cf490c8..0000000 --- a/src/HiSocket.Tcp.TestServer/obj/project.nuget.cache +++ /dev/null @@ -1,8 +0,0 @@ -{ - "version": 2, - "dgSpecHash": "Zz8tZRcqLIVbaTgqVmCoM2ImswCLlU7yPTG29iwGN2++50KaQ9vSMCVwOvnm5v0YYu6XE4AJF9mO6q2o4GgjlQ==", - "success": true, - "projectFilePath": "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Tcp.TestServer\\HiSocket.Tcp.TestServer.csproj", - "expectedPackageFiles": [], - "logs": [] -} \ No newline at end of file diff --git a/src/HiSocket.Tcp/Aes.cs b/src/HiSocket.Tcp/Aes.cs new file mode 100644 index 0000000..23d328b --- /dev/null +++ b/src/HiSocket.Tcp/Aes.cs @@ -0,0 +1,66 @@ +/*************************************************************** + * Description: 消息加密 + * + * Documents: https://github.com/hiram3512/HiSocket + * Support: hiramtan@live.com +***************************************************************/ + +using System; +using System.Collections.Generic; +using System.Text; + +namespace HiSocket.Tcp +{ + /// + /// + /// + public static class Aes + { + private static string _key; + + /// + /// 设置key + /// + /// + public static void SetKey(string key) + { + if (_key.Length != 32) + throw new Exception("please check key, current length is: " + _key.Length); + _key = key; + } + + /// + ///加密 + /// + ///需要被加密的数据 + /// + public static byte[] Encrypt(byte[] toEncrypt) + { + Byte[] keyArray = System.Text.Encoding.UTF8.GetBytes(_key); + System.Security.Cryptography.RijndaelManaged aes = new System.Security.Cryptography.RijndaelManaged(); + aes.Key = keyArray; + aes.Mode = System.Security.Cryptography.CipherMode.ECB; + aes.Padding = System.Security.Cryptography.PaddingMode.PKCS7; + System.Security.Cryptography.ICryptoTransform transform = aes.CreateEncryptor(); + Byte[] resultArray = transform.TransformFinalBlock(toEncrypt, 0, toEncrypt.Length); + return resultArray; + } + + /// + ///解密 + /// + ///需要被解密的数据 + /// + public static byte[] Decrypt(byte[] toDecrypt) + { + Byte[] keyArray = System.Text.Encoding.UTF8.GetBytes(_key); + System.Security.Cryptography.RijndaelManaged aes = new System.Security.Cryptography.RijndaelManaged(); + aes.Key = keyArray; + aes.Mode = System.Security.Cryptography.CipherMode.ECB; + aes.Padding = System.Security.Cryptography.PaddingMode.PKCS7; + System.Security.Cryptography.ICryptoTransform transform = aes.CreateDecryptor(); + Byte[] resultArray = transform.TransformFinalBlock(toDecrypt, 0, toDecrypt.Length); + return resultArray; + } + } +} diff --git a/src/HiSocket.Tcp/BlockBuffer.cs b/src/HiSocket.Tcp/BlockBuffer.cs index 1e26006..9023bfc 100644 --- a/src/HiSocket.Tcp/BlockBuffer.cs +++ b/src/HiSocket.Tcp/BlockBuffer.cs @@ -1,79 +1,76 @@ -using System; +/*************************************************************** + * Description: Block buffer for reuse array + * + * Documents: https://github.com/hiram3512/HiSocket + * Support: hiramtan@live.com +***************************************************************/ + +using System; using System.Collections.Generic; using System.Text; namespace HiSocket.Tcp { - class BlockBuffer : IBlockBuffer + + public class BlockBuffer : IBlockBuffer { - public T[] Buffer { get; } + public T[] Buffer { get; private set; } public int TotalCapcity { get; } public int Index { get; private set; } - public BlockBuffer(int capcity) { if (capcity <= 0) { - throw new ArgumentException("capcity<=0"); + throw new Exception("capcity<=0"); } Index = 0; + TotalCapcity = capcity; Buffer = new T[capcity]; } - public T[] Read(int count) { throw new NotImplementedException(); } + public T[] ReadFromHead(int count) + { + var data = TryReadFromHead(count); + DecreaseIndex(count); + return data; + } - public void WriteHead(T[] data, int sourceIndex, int sourceLength) + public T[] TryReadFromHead(int count) { - if (data == null) + if (count <= 0) { - throw new ArgumentNullException("data is null"); + throw new Exception("count<=0"); } - if (data.Length <= 0) + if (count > Index) { - throw new ArgumentNullException("data.Length<=0"); + throw new Exception("have no so many data"); } - if (sourceIndex < 0 || sourceIndex > data.Length) + T[] data = new T[count]; + Array.Copy(Buffer, 0, data, 0, count); + int remain = Index - count; + if (remain > 0) { - throw new ArgumentNullException("sourceIndex error"); + Array.Copy(Buffer, count, Buffer, 0, remain); } - if (sourceLength < 0 || sourceLength > data.Length - sourceIndex) - { - throw new ArgumentNullException("sourceLength error"); - } - int currentLength = Index + sourceLength; - if (currentLength >= TotalCapcity) - { - throw new Exception("buffer full, make a larger buffer"); - } - //for avoid over write data, first move second segment - if (Index > 0) - { - Array.Copy(Buffer, 0, Buffer, sourceLength, Index); - } - Array.Copy(data, sourceIndex, Buffer, 0, sourceLength); - IncreaseIndex(sourceLength); + return data; } - public void WriteEnd(T[] data, int sourceIndex, int sourceLength) + public void WriteAtEnd(T[] data, int sourceIndex, int sourceLength) { - if (data == null) + if (data == null || data.Length <= 0) { - throw new ArgumentNullException("data is null"); + throw new Exception("data null or empty"); } - if (data.Length <= 0) + if (sourceIndex < 0 || sourceIndex >= data.Length) { - throw new ArgumentNullException("data.Length<=0"); - } - if (sourceIndex < 0 || sourceIndex > data.Length) - { - throw new ArgumentNullException("sourceIndex error"); + throw new Exception("sourceIndex error"); } if (sourceLength < 0 || sourceLength > data.Length - sourceIndex) { - throw new ArgumentNullException("sourceLength error"); + throw new Exception("sourceLength error"); } - int currentLength = Index + sourceLength; - if (currentLength >= TotalCapcity) + int finalLength = Index + sourceLength; + if (finalLength > TotalCapcity) { throw new Exception("buffer full, make a larger buffer"); } @@ -94,12 +91,12 @@ public int GetCurrentCapcity() public void IncreaseIndex(int length) { Index += length; - if (Index >= TotalCapcity) + if (Index > TotalCapcity) { throw new Exception("buffer full, make a larger buffer"); } } - public void DecreaseIndex(int length) + private void DecreaseIndex(int length) { Index -= length; if (Index < 0) @@ -108,15 +105,18 @@ public void DecreaseIndex(int length) } } - public void RemoveFront(int length) + public void WriteAtEnd(T[] data) { - int currentIndex = Index - length; - if (currentIndex < 0) + if (data == null || data.Length <= 0) { - throw new Exception("no so many data to remove"); + throw new Exception("data null or empty"); } - Array.Copy(Buffer, Index, Buffer, 0, length); - DecreaseIndex(length); + WriteAtEnd(data, 0, data.Length); + } + + public void Dispose() + { + Buffer = null; } } } diff --git a/src/HiSocket.Tcp/HiSocket.Tcp.csproj b/src/HiSocket.Tcp/HiSocket.Tcp.csproj index 4a93bde..5ebf10b 100644 --- a/src/HiSocket.Tcp/HiSocket.Tcp.csproj +++ b/src/HiSocket.Tcp/HiSocket.Tcp.csproj @@ -1,11 +1,8 @@ - + netstandard2.0 + true - - - - diff --git a/src/HiSocket.Tcp/IBlockBuffer.cs b/src/HiSocket.Tcp/IBlockBuffer.cs index 95db674..0da647d 100644 --- a/src/HiSocket.Tcp/IBlockBuffer.cs +++ b/src/HiSocket.Tcp/IBlockBuffer.cs @@ -1,41 +1,73 @@ -using System; +/*************************************************************** + * Description: Block buffer for reuse array + * + * Documents: https://github.com/hiram3512/HiSocket + * Support: hiramtan@live.com +***************************************************************/ + +using System; using System.Collections.Generic; using System.Text; namespace HiSocket.Tcp { - public interface IBlockBuffer + /// + /// Block buffer, mostly write at end, read from head + /// + /// + public interface IBlockBuffer : IDisposable { + /// + /// Buffer contain data + /// T[] Buffer { get; } - int TotalCapcity { get; } - int Index { get; } + /// + /// Capcity of buffer + /// + int TotalCapcity { get; } + /// + /// Current index position, this mean how many data store currently + /// + int Index { get; } /// /// Always read from 0 index, and also move length /// /// /// - T[] Read(int count); - - void WriteHead(T[] data, int sourceIndex, int sourceLength); - + T[] ReadFromHead(int count); + /// + /// Always read from 0 index, and don't move length + /// + /// + /// + T[] TryReadFromHead(int count); /// - /// Also write at length index, and also move length + /// Write at end and move index /// /// - void WriteEnd(T[] data, int sourceIndex, int sourceLength); + void WriteAtEnd(T[] data, int sourceIndex, int sourceLength); + /// + /// Write at end and move index + /// + /// + void WriteAtEnd(T[] data); + /// + /// Current capcity + /// + /// int GetCurrentCapcity(); + /// + /// IncreaseIndex + /// + /// void IncreaseIndex(int length); - - void DecreaseIndex(int length); - - void RemoveFront(int length); } } diff --git a/src/HiSocket.Tcp/IPackage.cs b/src/HiSocket.Tcp/IPackage.cs index 2632b2e..d9d6d6d 100644 --- a/src/HiSocket.Tcp/IPackage.cs +++ b/src/HiSocket.Tcp/IPackage.cs @@ -1,12 +1,29 @@ -using System; -using System.Collections.Generic; -using System.Text; +/*************************************************************** + * Description: Block buffer for reuse array + * + * Documents: https://github.com/hiram3512/HiSocket + * Support: hiramtan@live.com +***************************************************************/ namespace HiSocket.Tcp { - interface IPackage + /// + /// Package interface for spit bytes + /// + public interface IPackage { - void Pack(byte[] data, IBlockBuffer buffer); - void Unpack(IBlockBuffer buffer, byte[] data); + /// + /// Add head bytes and pack a new bytes to send + /// + /// + /// + void Pack(byte[] message, IBlockBuffer sendBuffer); + + /// + /// Get data from receive buffer and split by head + /// + /// + /// + void Unpack(IBlockBuffer receiveBuffer, ref byte[] message); } } \ No newline at end of file diff --git a/src/HiSocket.Tcp/ITcpConnection.cs b/src/HiSocket.Tcp/ITcpConnection.cs index 15610ef..f718b30 100644 --- a/src/HiSocket.Tcp/ITcpConnection.cs +++ b/src/HiSocket.Tcp/ITcpConnection.cs @@ -1,19 +1,35 @@ -using System; +/*************************************************************** + * Description: Block buffer for reuse array + * + * Documents: https://github.com/hiram3512/HiSocket + * Support: hiramtan@live.com +***************************************************************/ + +using System; using System.Collections.Generic; using System.Text; namespace HiSocket.Tcp { - interface ITcpConnection + /// + /// Tcp connection + /// + public interface ITcpConnection { /// /// Trigger when send message /// - event Action OnSend; + event Action OnSendMessage; /// /// Trigger when recieve message /// - event Action OnReceive; + event Action OnReceiveMessage; + + /// + /// Send Message + /// + /// + void Send(byte[] data); } } diff --git a/src/HiSocket.Tcp/ITcpSocket.cs b/src/HiSocket.Tcp/ITcpSocket.cs index 5322965..e1dec79 100644 --- a/src/HiSocket.Tcp/ITcpSocket.cs +++ b/src/HiSocket.Tcp/ITcpSocket.cs @@ -1,51 +1,72 @@ -using System; -using System.Collections.Generic; -using System.Text; -using CircularBuffer; +/*************************************************************** + * Description: Block buffer for reuse array + * + * Documents: https://github.com/hiram3512/HiSocket + * Support: hiramtan@live.com +***************************************************************/ + +using System; using System.Net; namespace HiSocket.Tcp { - interface ITcpSocket : IDisposable + /// + /// Tcp socket interface + /// + public interface ITcpSocket : IDisposable { + /// + /// Socket instance + /// System.Net.Sockets.Socket Socket { get; } /// - /// trigger when connecting + /// when connecting /// event Action OnConnecting; /// - /// trigger when connected + /// when connected /// event Action OnConnected; /// - /// Trigger when disconnecte + /// when disconnecte /// event Action OnDisconnected; - IBlockBuffer SendBuffer { get; set; } + /// + /// when exception + /// + event Action OnException; + + /// + /// + /// + IBlockBuffer SendBuffer { get; set; } - IBlockBuffer ReceiveBuffer { get; set; } + /// + /// + /// + IBlockBuffer ReceiveBuffer { get; set; } /// /// trigger when get bytes from server /// use .net socket api /// - event Action, int, int> OnReceiveBytes; + event Action> OnReceiveBytes; /// /// trigger when send bytes to server /// use .net socket api /// - event Action, int, int> OnSendBytes; + event Action OnSendBytes; /// /// Connect to server /// /// server - void Connect(IPEndPoint iep); + void Connect(EndPoint iep); /// /// Connect to server @@ -68,6 +89,12 @@ interface ITcpSocket : IDisposable /// void ConnectWWW(string www, int port); + + /// + /// Send buffer data + /// + void SendBytesInBuffer(); + /// /// Send bytes to server /// diff --git a/src/HiSocket.Tcp/PackageBase.cs b/src/HiSocket.Tcp/PackageBase.cs deleted file mode 100644 index 68e0ec5..0000000 --- a/src/HiSocket.Tcp/PackageBase.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace HiSocket.Tcp -{ - public abstract class PackageBase:IPackage - { - public void Pack(byte[] data, IBlockBuffer buffer) - { - buffer.WriteHead(data, 0, data.Length); - buffer.WriteHead(new byte[2],0,2); - } - - public void Unpack(IBlockBuffer buffer, byte[] data) - { - buffer.Read(2); - } - } -} \ No newline at end of file diff --git a/src/HiSocket.Tcp/Ping.cs b/src/HiSocket.Tcp/Ping.cs new file mode 100644 index 0000000..fab96f8 --- /dev/null +++ b/src/HiSocket.Tcp/Ping.cs @@ -0,0 +1,38 @@ +/*************************************************************** + * Description: Block buffer for reuse array + * + * Documents: https://github.com/hiram3512/HiSocket + * Support: hiramtan@live.com +***************************************************************/ + +using System.Net; +using System.Net.NetworkInformation; + +namespace HiSocket.Tcp +{ + /// + /// + /// + public static class Ping + { + public static System.Net.NetworkInformation.Ping sender = new System.Net.NetworkInformation.Ping(); + + /// + /// Get ping + /// Note: tick to get current ping + /// + /// + /// + public static long GetPint(TcpConnection tcpConnection) + { + long time = 0; + var iep = tcpConnection.Socket.RemoteEndPoint as System.Net.IPEndPoint; + var reply = sender.Send(iep.Address); + if (reply.Status == IPStatus.Success) + { + time = reply.RoundtripTime; + } + return time; + } + } +} diff --git a/src/HiSocket.Tcp/TcpConnection.cs b/src/HiSocket.Tcp/TcpConnection.cs index 1363b87..46d73ad 100644 --- a/src/HiSocket.Tcp/TcpConnection.cs +++ b/src/HiSocket.Tcp/TcpConnection.cs @@ -1,40 +1,75 @@ -using System; +/*************************************************************** + * Description: Block buffer for reuse array + * + * Documents: https://github.com/hiram3512/HiSocket + * Support: hiramtan@live.com +***************************************************************/ + +using System; using System.Collections.Generic; using System.Text; namespace HiSocket.Tcp { - class TcpConnection : TcpSocket, ITcpConnection + /// + /// + /// + public class TcpConnection : TcpSocket, ITcpConnection { /// /// Trigger when send message /// - public event Action OnSend; + public event Action OnSendMessage; /// /// Trigger when recieve message /// - public event Action OnReceive; - + public event Action OnReceiveMessage; private IPackage _package; - public TcpConnection(IPackage package) + + public TcpConnection(IPackage package) : base() { if (package == null) { - throw new ArgumentNullException("package is null"); + ExceptionEvent(new Exception("package is null")); } _package = package; + OnReceiveBytes += OnReceiveBytesFromSocket; } + public void Send(byte[] data) { if (data == null || data.Length == 0) { - throw new ArgumentException("data error"); + ExceptionEvent(new Exception("data null or empty")); } + SendMessageEvent(data); _package.Pack(data, SendBuffer); - SendBytes(SendBuffer.Buffer, 0, SendBuffer.Index); + SendBytesInBuffer(); + } + + private void OnReceiveBytesFromSocket(IBlockBuffer buffer) + { + byte[] bytes = new byte[] { }; + _package.Unpack(buffer, ref bytes); + ReceiveMessageEvent(bytes); + } + + private void ReceiveMessageEvent(byte[] data) + { + if (OnReceiveMessage != null) + { + OnReceiveMessage(data); + } + } + private void SendMessageEvent(byte[] data) + { + if (OnSendMessage != null) + { + OnSendMessage(data); + } } } } diff --git a/src/HiSocket.Tcp/TcpSocket.cs b/src/HiSocket.Tcp/TcpSocket.cs index 1b0f2d9..66c29f0 100644 --- a/src/HiSocket.Tcp/TcpSocket.cs +++ b/src/HiSocket.Tcp/TcpSocket.cs @@ -1,18 +1,20 @@ -using System; +/*************************************************************** + * Description: Block buffer for reuse array + * + * Documents: https://github.com/hiram3512/HiSocket + * Support: hiramtan@live.com +***************************************************************/ + +using System; using System.Net; using System.Net.Sockets; namespace HiSocket.Tcp { - class TcpSocket : ITcpSocket + public class TcpSocket : ITcpSocket { - public System.Net.Sockets.Socket Socket { get; private set; } - //CircularBuffer SendBuffer { get; } - - //CircularBuffer ReceiveBuffer { get; } - /// /// trigger when connecting /// @@ -28,24 +30,26 @@ class TcpSocket : ITcpSocket /// public event Action OnDisconnected; + /// + /// when exception + /// + public event Action OnException; - public event Action OnError; - - public IBlockBuffer SendBuffer { get; set; } + public IBlockBuffer SendBuffer { get; set; } - public IBlockBuffer ReceiveBuffer { get; set; } + public IBlockBuffer ReceiveBuffer { get; set; } /// /// trigger when get bytes from server /// use .net socket api /// - public event Action, int, int> OnReceiveBytes; + public event Action> OnReceiveBytes; /// /// trigger when send bytes to server /// use .net socket api /// - public event Action, int, int> OnSendBytes; + public event Action OnSendBytes; public TcpSocket(int bufferSize = 1 << 16) { @@ -53,41 +57,31 @@ public TcpSocket(int bufferSize = 1 << 16) ReceiveBuffer = new BlockBuffer(bufferSize); } - public void Connect(IPEndPoint iep) + public void Connect(EndPoint endPoint) { - if (iep == null) - { - ErrorEvent(new ArgumentNullException("iep is null")); - return; - } ConnectingEvent(); try { - Socket = new System.Net.Sockets.Socket(iep.AddressFamily, SocketType.Stream, ProtocolType.Tcp); - Socket.BeginConnect(iep, EndConnect, Socket); + Socket = new System.Net.Sockets.Socket(endPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); + Socket.BeginConnect(endPoint, ConnectCallback, Socket); } catch (Exception e) { - ErrorEvent(e); + ExceptionEvent(e); return; } } - private void EndConnect(IAsyncResult ar) + private void ConnectCallback(IAsyncResult ar) { - var socket = ar.AsyncState as System.Net.Sockets.Socket; - if (socket == null) - { - ErrorEvent(new ArgumentNullException("socket is null")); - return; - } try { + var socket = ar.AsyncState as System.Net.Sockets.Socket; socket.EndConnect(ar); } catch (Exception e) { - ErrorEvent(e); + ExceptionEvent(e); return; } ConnectedEvent(); @@ -97,128 +91,106 @@ private void EndConnect(IAsyncResult ar) public void Connect(string ip, int port) { - if (String.IsNullOrEmpty(ip)) + IPEndPoint iep = null; + try + { + iep = new IPEndPoint(IPAddress.Parse(ip), port); + } + catch (Exception e) { - ErrorEvent(new ArgumentNullException("ip is null or empty")); + ExceptionEvent(e); return; } - var iep = new IPEndPoint(IPAddress.Parse(ip), port); Connect(iep); } public void Connect(IPAddress ip, int port) { - if (ip == null) + IPEndPoint iep = null; + try + { + iep = new IPEndPoint(ip, port); + } + catch (Exception e) { - ErrorEvent(new ArgumentNullException("iep is null")); + ExceptionEvent(e); return; } - var iep = new IPEndPoint(ip, port); Connect(iep); } public void ConnectWWW(string www, int port) { - if (String.IsNullOrEmpty(www)) - { - ErrorEvent(new ArgumentNullException("www is null or empty")); - return; - } - var hostEntry = Dns.GetHostEntry(www); - if (hostEntry.AddressList == null) + IPEndPoint iep = null; + try { - ErrorEvent(new ArgumentNullException("AddressList is null")); - return; + var hostEntry = Dns.GetHostEntry(www); + iep = new IPEndPoint(hostEntry.AddressList[0], port); } - if (hostEntry.AddressList.Length == 0) + catch (Exception e) { - ErrorEvent(new ArgumentException("AddressList length is 0")); + ExceptionEvent(e); return; } - IPEndPoint ipe = new IPEndPoint(hostEntry.AddressList[0], port); - Connect(ipe); + Connect(iep); } - public void SendBytes(byte[] bytes) + public void SendBytesInBuffer() { - if (bytes == null) + try { - ErrorEvent(new ArgumentNullException("bytes is null")); - return; + if (SendBuffer.Index > 0) + { + Socket.BeginSend(SendBuffer.Buffer, 0, SendBuffer.Index, SocketFlags.None, SendCallback, Socket); + } + } + catch (Exception e) + { + ExceptionEvent(e); } - SendBytes(bytes, 0, bytes.Length); } - public void SendBytes(byte[] bytes, int index, int length) + public void SendBytes(byte[] bytes) { - if (bytes == null) - { - ErrorEvent(new ArgumentNullException("bytes is null")); - return; - } - if (index < 0) - { - ErrorEvent(new ArgumentException("index<0")); - return; - } - if (length > bytes.Length) + try { - ErrorEvent(new ArgumentException("length>bytes.Length")); - return; + SendBytes(bytes, 0, bytes.Length); } - if (Socket == null) + catch (Exception e) { - ErrorEvent(new ArgumentNullException("socket is null")); + ExceptionEvent(e); return; } - if (Socket.Connected) + } + + public void SendBytes(byte[] bytes, int index, int length) + { + try { - try - { - //write into buffer, maybe cannot finish send all at one time, resend them - SendBuffer.WriteEnd(bytes, index, length); - Socket.BeginSend(bytes, index, length, SocketFlags.None, EndSend, Socket); - } - catch (Exception e) - { - ErrorEvent(e); - } + //write into buffer, maybe cannot finish send all at one time, resend them + SendBuffer.WriteAtEnd(bytes, index, length); + SendBytesInBuffer(); } - else + catch (Exception e) { - DisconnectedEvent(); + ExceptionEvent(e); } } - private void EndSend(IAsyncResult ar) + private void SendCallback(IAsyncResult ar) { - if (Socket.Connected) + try { var socket = ar.AsyncState as System.Net.Sockets.Socket; - if (socket == null) - { - ErrorEvent(new ArgumentNullException("socket is null")); - return; - } int length = 0; - try - { - length = socket.EndSend(ar); - } - catch (Exception e) - { - ErrorEvent(e); - return; - } + length = socket.EndSend(ar); if (length > 0) { - SendBytesEvent(0, length); - SendBuffer.RemoveFront(length); - int remain = SendBuffer.GetCurrentCapcity(); + byte[] data = SendBuffer.ReadFromHead(length); + SendBytesEvent(data); + int remain = SendBuffer.Index; if (remain > 0) { - int index = SendBuffer.Index; - int capcity = SendBuffer.GetCurrentCapcity(); - SendBytes(SendBuffer.Buffer, index, capcity); + SendBytes(SendBuffer.Buffer, 0, SendBuffer.Index); } } else @@ -226,19 +198,14 @@ private void EndSend(IAsyncResult ar) DisconnectedEvent(); } } - else + catch (Exception e) { - DisconnectedEvent(); + ExceptionEvent(e); } } public void Disconnect() { - if (Socket == null) - { - ErrorEvent(new ArgumentNullException("socket is null")); - return; - } try { Socket.Shutdown(SocketShutdown.Both); @@ -246,7 +213,8 @@ public void Disconnect() } catch (Exception e) { - ErrorEvent(e); + ExceptionEvent(e); + return; } DisconnectedEvent(); } @@ -254,54 +222,38 @@ public void Disconnect() public void Dispose() { Disconnect(); + SendBuffer.Dispose(); + SendBuffer = null; + ReceiveBuffer.Dispose(); + ReceiveBuffer = null; } private void ReceiveBytes() { - if (Socket.Connected) + try { - try - { - int index = ReceiveBuffer.Index; - int count = ReceiveBuffer.GetCurrentCapcity(); - Socket.BeginReceive(ReceiveBuffer.Buffer, index, count, SocketFlags.None, EndReceive, Socket); - } - catch (Exception e) - { - ErrorEvent(e); - return; - } + int index = ReceiveBuffer.Index; + int count = ReceiveBuffer.GetCurrentCapcity(); + Socket.BeginReceive(ReceiveBuffer.Buffer, index, count, SocketFlags.None, ReceiveCallback, Socket); } - else + catch (Exception e) { - DisconnectedEvent(); + ExceptionEvent(e); + return; } } - private void EndReceive(IAsyncResult ar) + private void ReceiveCallback(IAsyncResult ar) { - if (Socket.Connected) + try { var socket = ar.AsyncState as System.Net.Sockets.Socket; - if (socket == null) - { - ErrorEvent(new ArgumentNullException("socket is null")); - return; - } int length = 0; - try - { - length = socket.EndReceive(ar); - } - catch (Exception e) - { - ErrorEvent(e); - return; - } + length = socket.EndReceive(ar); if (length > 0) { ReceiveBuffer.IncreaseIndex(length); - ReceiveBytesEvent(0, ReceiveBuffer.Index); + ReceiveBytesEvent(ReceiveBuffer); ReceiveBytes(); } else @@ -309,9 +261,9 @@ private void EndReceive(IAsyncResult ar) DisconnectedEvent(); } } - else + catch (Exception e) { - DisconnectedEvent(); + ExceptionEvent(e); } } @@ -339,27 +291,27 @@ private void DisconnectedEvent() } } - private void ErrorEvent(Exception ex) + protected void ExceptionEvent(Exception ex) { - if (OnError != null) + if (OnException != null) { - OnError(ex); + OnException(ex); } } - private void SendBytesEvent(int index, int length) + private void SendBytesEvent(byte[] data) { if (OnSendBytes != null) { - OnSendBytes(SendBuffer, index, length); + OnSendBytes(data); } } - private void ReceiveBytesEvent(int index, int length) + private void ReceiveBytesEvent(IBlockBuffer receiveBuffer) { if (OnReceiveBytes != null) { - OnReceiveBytes(ReceiveBuffer, index, length); + OnReceiveBytes(receiveBuffer); } } } diff --git a/src/HiSocket.Tcp/bin/Debug/netstandard2.0/CircularBuffer.dll b/src/HiSocket.Tcp/bin/Debug/netstandard2.0/CircularBuffer.dll deleted file mode 100644 index 8bfd7e3..0000000 Binary files a/src/HiSocket.Tcp/bin/Debug/netstandard2.0/CircularBuffer.dll and /dev/null differ diff --git a/src/HiSocket.Tcp/bin/Debug/netstandard2.0/CircularBuffer.pdb b/src/HiSocket.Tcp/bin/Debug/netstandard2.0/CircularBuffer.pdb deleted file mode 100644 index cd3885e..0000000 Binary files a/src/HiSocket.Tcp/bin/Debug/netstandard2.0/CircularBuffer.pdb and /dev/null differ diff --git a/src/HiSocket.Tcp/bin/Debug/netstandard2.0/CircularBuffer.xml b/src/HiSocket.Tcp/bin/Debug/netstandard2.0/CircularBuffer.xml deleted file mode 100644 index ec4ddfa..0000000 --- a/src/HiSocket.Tcp/bin/Debug/netstandard2.0/CircularBuffer.xml +++ /dev/null @@ -1,190 +0,0 @@ - - - - CircularBuffer - - - - - - Circular buffer. - - When writing to a full buffer: - PushBack -> removes this[0] / Front() - PushFront -> removes this[Size-1] / Back() - - this implementation is inspired by - http://www.boost.org/doc/libs/1_53_0/libs/circular_buffer/doc/circular_buffer.html - because I liked their interface. - - - - - The _start. Index of the first element in buffer. - - - - - The _end. Index after the last element in the buffer. - - - - - The _size. Buffer size. - - - - - Initializes a new instance of the class. - - - - Buffer capacity. Must be positive. - - - - - Initializes a new instance of the class. - - - - Buffer capacity. Must be positive. - - - Items to fill buffer with. Items length must be less than capacity. - Suggestion: use Skip(x).Take(y).ToArray() to build this argument from - any enumerable. - - - - - Maximum capacity of the buffer. Elements pushed into the buffer after - maximum capacity is reached (IsFull = true), will remove an element. - - - - - Boolean indicating if Circular is at full capacity. - Adding more elements when the buffer is full will - cause elements to be removed from the other end - of the buffer. - - - - - True if has no elements. - - - - - Current buffer size (the number of elements that the buffer has). - - - - - Element at the front of the buffer - this[0]. - - The value of the element of type T at the front of the buffer. - - - - Element at the back of the buffer - this[Size - 1]. - - The value of the element of type T at the back of the buffer. - - - - Index access to elements in buffer. - Index does not loop around like when adding elements, - valid interval is [0;Size[ - - Index of element to access. - Thrown when index is outside of [; Size[ interval. - - - - Pushes a new element to the back of the buffer. Back()/this[Size-1] - will now return this element. - - When the buffer is full, the element at Front()/this[0] will be - popped to allow for this new element to fit. - - Item to push to the back of the buffer - - - - Pushes a new element to the front of the buffer. Front()/this[0] - will now return this element. - - When the buffer is full, the element at Back()/this[Size-1] will be - popped to allow for this new element to fit. - - Item to push to the front of the buffer - - - - Removes the element at the back of the buffer. Decreasing the - Buffer size by 1. - - - - - Removes the element at the front of the buffer. Decreasing the - Buffer size by 1. - - - - - Copies the buffer contents to an array, according to the logical - contents of the buffer (i.e. independent of the internal - order/contents) - - A new array with a copy of the buffer contents. - - - - Get the contents of the buffer as 2 ArraySegments. - Respects the logical contents of the buffer, where - each segment and items in each segment are ordered - according to insertion. - - Fast: does not copy the array elements. - Useful for methods like Send(IList<ArraySegment<Byte>>). - - Segments may be empty. - - An IList with 2 segments corresponding to the buffer content. - - - - Returns an enumerator that iterates through this buffer. - - An enumerator that can be used to iterate this collection. - - - - Increments the provided index variable by one, wrapping - around if necessary. - - - - - - Decrements the provided index variable by one, wrapping - around if necessary. - - - - - - Converts the index in the argument to an index in _buffer - - - The transformed index. - - - External index. - - - - diff --git a/src/HiSocket.Tcp/bin/Debug/netstandard2.0/HiSocket.Tcp.deps.json b/src/HiSocket.Tcp/bin/Debug/netstandard2.0/HiSocket.Tcp.deps.json deleted file mode 100644 index a8b389f..0000000 --- a/src/HiSocket.Tcp/bin/Debug/netstandard2.0/HiSocket.Tcp.deps.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "runtimeTarget": { - "name": ".NETStandard,Version=v2.0/", - "signature": "" - }, - "compilationOptions": {}, - "targets": { - ".NETStandard,Version=v2.0": {}, - ".NETStandard,Version=v2.0/": { - "HiSocket.Tcp/1.0.0": { - "dependencies": { - "CircularBuffer": "1.0.0", - "NETStandard.Library": "2.0.3" - }, - "runtime": { - "HiSocket.Tcp.dll": {} - } - }, - "Microsoft.NETCore.Platforms/1.1.0": {}, - "NETStandard.Library/2.0.3": { - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0" - } - }, - "CircularBuffer/1.0.0": { - "runtime": { - "CircularBuffer.dll": {} - } - } - } - }, - "libraries": { - "HiSocket.Tcp/1.0.0": { - "type": "project", - "serviceable": false, - "sha512": "" - }, - "Microsoft.NETCore.Platforms/1.1.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==", - "path": "microsoft.netcore.platforms/1.1.0", - "hashPath": "microsoft.netcore.platforms.1.1.0.nupkg.sha512" - }, - "NETStandard.Library/2.0.3": { - "type": "package", - "serviceable": true, - "sha512": "sha512-st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==", - "path": "netstandard.library/2.0.3", - "hashPath": "netstandard.library.2.0.3.nupkg.sha512" - }, - "CircularBuffer/1.0.0": { - "type": "project", - "serviceable": false, - "sha512": "" - } - } -} \ No newline at end of file diff --git a/src/HiSocket.Tcp/bin/Debug/netstandard2.0/HiSocket.Tcp.dll b/src/HiSocket.Tcp/bin/Debug/netstandard2.0/HiSocket.Tcp.dll deleted file mode 100644 index 228fb31..0000000 Binary files a/src/HiSocket.Tcp/bin/Debug/netstandard2.0/HiSocket.Tcp.dll and /dev/null differ diff --git a/src/HiSocket.Tcp/bin/Debug/netstandard2.0/HiSocket.Tcp.pdb b/src/HiSocket.Tcp/bin/Debug/netstandard2.0/HiSocket.Tcp.pdb deleted file mode 100644 index 48f6491..0000000 Binary files a/src/HiSocket.Tcp/bin/Debug/netstandard2.0/HiSocket.Tcp.pdb and /dev/null differ diff --git a/src/HiSocket.Tcp/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs b/src/HiSocket.Tcp/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs deleted file mode 100644 index 45b1ca0..0000000 --- a/src/HiSocket.Tcp/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs +++ /dev/null @@ -1,4 +0,0 @@ -// -using System; -using System.Reflection; -[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.0", FrameworkDisplayName = "")] diff --git a/src/HiSocket.Tcp/obj/Debug/netstandard2.0/HiSocket.Tcp.AssemblyInfo.cs b/src/HiSocket.Tcp/obj/Debug/netstandard2.0/HiSocket.Tcp.AssemblyInfo.cs deleted file mode 100644 index 8f14ee8..0000000 --- a/src/HiSocket.Tcp/obj/Debug/netstandard2.0/HiSocket.Tcp.AssemblyInfo.cs +++ /dev/null @@ -1,23 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -using System; -using System.Reflection; - -[assembly: System.Reflection.AssemblyCompanyAttribute("HiSocket.Tcp")] -[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] -[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] -[assembly: System.Reflection.AssemblyProductAttribute("HiSocket.Tcp")] -[assembly: System.Reflection.AssemblyTitleAttribute("HiSocket.Tcp")] -[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] - -// Generated by the MSBuild WriteCodeFragment class. - diff --git a/src/HiSocket.Tcp/obj/Debug/netstandard2.0/HiSocket.Tcp.AssemblyInfoInputs.cache b/src/HiSocket.Tcp/obj/Debug/netstandard2.0/HiSocket.Tcp.AssemblyInfoInputs.cache deleted file mode 100644 index 47be111..0000000 --- a/src/HiSocket.Tcp/obj/Debug/netstandard2.0/HiSocket.Tcp.AssemblyInfoInputs.cache +++ /dev/null @@ -1 +0,0 @@ -bab9e11357769da64fc3517de948ebd6ac676f2c diff --git a/src/HiSocket.Tcp/obj/Debug/netstandard2.0/HiSocket.Tcp.GeneratedMSBuildEditorConfig.editorconfig b/src/HiSocket.Tcp/obj/Debug/netstandard2.0/HiSocket.Tcp.GeneratedMSBuildEditorConfig.editorconfig deleted file mode 100644 index 4cf4bd9..0000000 --- a/src/HiSocket.Tcp/obj/Debug/netstandard2.0/HiSocket.Tcp.GeneratedMSBuildEditorConfig.editorconfig +++ /dev/null @@ -1,3 +0,0 @@ -is_global = true -build_property.RootNamespace = HiSocket.Tcp -build_property.ProjectDir = D:\HiGit\GitHub\HiSocket\src\HiSocket.Tcp\ diff --git a/src/HiSocket.Tcp/obj/Debug/netstandard2.0/HiSocket.Tcp.assets.cache b/src/HiSocket.Tcp/obj/Debug/netstandard2.0/HiSocket.Tcp.assets.cache deleted file mode 100644 index 203cae0..0000000 Binary files a/src/HiSocket.Tcp/obj/Debug/netstandard2.0/HiSocket.Tcp.assets.cache and /dev/null differ diff --git a/src/HiSocket.Tcp/obj/Debug/netstandard2.0/HiSocket.Tcp.csproj.AssemblyReference.cache b/src/HiSocket.Tcp/obj/Debug/netstandard2.0/HiSocket.Tcp.csproj.AssemblyReference.cache deleted file mode 100644 index 41cf896..0000000 Binary files a/src/HiSocket.Tcp/obj/Debug/netstandard2.0/HiSocket.Tcp.csproj.AssemblyReference.cache and /dev/null differ diff --git a/src/HiSocket.Tcp/obj/Debug/netstandard2.0/HiSocket.Tcp.csproj.CoreCompileInputs.cache b/src/HiSocket.Tcp/obj/Debug/netstandard2.0/HiSocket.Tcp.csproj.CoreCompileInputs.cache deleted file mode 100644 index 65c8e80..0000000 --- a/src/HiSocket.Tcp/obj/Debug/netstandard2.0/HiSocket.Tcp.csproj.CoreCompileInputs.cache +++ /dev/null @@ -1 +0,0 @@ -47474688908e0e4ba2b164a5639533eb7d07a8c0 diff --git a/src/HiSocket.Tcp/obj/Debug/netstandard2.0/HiSocket.Tcp.csproj.FileListAbsolute.txt b/src/HiSocket.Tcp/obj/Debug/netstandard2.0/HiSocket.Tcp.csproj.FileListAbsolute.txt deleted file mode 100644 index b269f77..0000000 --- a/src/HiSocket.Tcp/obj/Debug/netstandard2.0/HiSocket.Tcp.csproj.FileListAbsolute.txt +++ /dev/null @@ -1,14 +0,0 @@ -D:\HiGit\GitHub\HiSocket\src\HiSocket.Tcp\obj\Debug\netstandard2.0\HiSocket.Tcp.csproj.AssemblyReference.cache -D:\HiGit\GitHub\HiSocket\src\HiSocket.Tcp\obj\Debug\netstandard2.0\HiSocket.Tcp.GeneratedMSBuildEditorConfig.editorconfig -D:\HiGit\GitHub\HiSocket\src\HiSocket.Tcp\obj\Debug\netstandard2.0\HiSocket.Tcp.AssemblyInfoInputs.cache -D:\HiGit\GitHub\HiSocket\src\HiSocket.Tcp\obj\Debug\netstandard2.0\HiSocket.Tcp.AssemblyInfo.cs -D:\HiGit\GitHub\HiSocket\src\HiSocket.Tcp\obj\Debug\netstandard2.0\HiSocket.Tcp.csproj.CoreCompileInputs.cache -D:\HiGit\GitHub\HiSocket\src\HiSocket.Tcp\bin\Debug\netstandard2.0\HiSocket.Tcp.deps.json -D:\HiGit\GitHub\HiSocket\src\HiSocket.Tcp\bin\Debug\netstandard2.0\HiSocket.Tcp.dll -D:\HiGit\GitHub\HiSocket\src\HiSocket.Tcp\bin\Debug\netstandard2.0\HiSocket.Tcp.pdb -D:\HiGit\GitHub\HiSocket\src\HiSocket.Tcp\bin\Debug\netstandard2.0\CircularBuffer.dll -D:\HiGit\GitHub\HiSocket\src\HiSocket.Tcp\bin\Debug\netstandard2.0\CircularBuffer.pdb -D:\HiGit\GitHub\HiSocket\src\HiSocket.Tcp\bin\Debug\netstandard2.0\CircularBuffer.xml -D:\HiGit\GitHub\HiSocket\src\HiSocket.Tcp\obj\Debug\netstandard2.0\HiSocket.Tcp.dll -D:\HiGit\GitHub\HiSocket\src\HiSocket.Tcp\obj\Debug\netstandard2.0\HiSocket.Tcp.pdb -D:\HiGit\GitHub\HiSocket\src\HiSocket.Tcp\obj\Debug\netstandard2.0\HiSocket.Tcp.csproj.CopyComplete diff --git a/src/HiSocket.Tcp/obj/Debug/netstandard2.0/HiSocket.Tcp.dll b/src/HiSocket.Tcp/obj/Debug/netstandard2.0/HiSocket.Tcp.dll deleted file mode 100644 index 228fb31..0000000 Binary files a/src/HiSocket.Tcp/obj/Debug/netstandard2.0/HiSocket.Tcp.dll and /dev/null differ diff --git a/src/HiSocket.Tcp/obj/Debug/netstandard2.0/HiSocket.Tcp.pdb b/src/HiSocket.Tcp/obj/Debug/netstandard2.0/HiSocket.Tcp.pdb deleted file mode 100644 index 48f6491..0000000 Binary files a/src/HiSocket.Tcp/obj/Debug/netstandard2.0/HiSocket.Tcp.pdb and /dev/null differ diff --git a/src/HiSocket.Tcp/obj/HiSocket.Tcp.csproj.nuget.dgspec.json b/src/HiSocket.Tcp/obj/HiSocket.Tcp.csproj.nuget.dgspec.json deleted file mode 100644 index 5b4f80c..0000000 --- a/src/HiSocket.Tcp/obj/HiSocket.Tcp.csproj.nuget.dgspec.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "format": 1, - "restore": { - "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Tcp\\HiSocket.Tcp.csproj": {} - }, - "projects": { - "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Tcp\\HiSocket.Tcp.csproj": { - "version": "1.0.0", - "restore": { - "projectUniqueName": "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Tcp\\HiSocket.Tcp.csproj", - "projectName": "HiSocket.Tcp", - "projectPath": "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Tcp\\HiSocket.Tcp.csproj", - "packagesPath": "C:\\Users\\hiramtan\\.nuget\\packages\\", - "outputPath": "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Tcp\\obj\\", - "projectStyle": "PackageReference", - "fallbackFolders": [ - "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" - ], - "configFilePaths": [ - "C:\\Users\\hiramtan\\AppData\\Roaming\\NuGet\\NuGet.Config", - "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config", - "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" - ], - "originalTargetFrameworks": [ - "netstandard2.0" - ], - "sources": { - "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, - "https://api.nuget.org/v3/index.json": {} - }, - "frameworks": { - "netstandard2.0": { - "targetAlias": "netstandard2.0", - "projectReferences": {} - } - }, - "warningProperties": { - "warnAsError": [ - "NU1605" - ] - } - }, - "frameworks": { - "netstandard2.0": { - "targetAlias": "netstandard2.0", - "dependencies": { - "NETStandard.Library": { - "suppressParent": "All", - "target": "Package", - "version": "[2.0.3, )", - "autoReferenced": true - } - }, - "imports": [ - "net461", - "net462", - "net47", - "net471", - "net472", - "net48" - ], - "assetTargetFallback": true, - "warn": true, - "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.402\\RuntimeIdentifierGraph.json" - } - } - } - } -} \ No newline at end of file diff --git a/src/HiSocket.Tcp/obj/HiSocket.Tcp.csproj.nuget.g.props b/src/HiSocket.Tcp/obj/HiSocket.Tcp.csproj.nuget.g.props deleted file mode 100644 index 59f2fb5..0000000 --- a/src/HiSocket.Tcp/obj/HiSocket.Tcp.csproj.nuget.g.props +++ /dev/null @@ -1,19 +0,0 @@ - - - - True - NuGet - $(MSBuildThisFileDirectory)project.assets.json - $(UserProfile)\.nuget\packages\ - C:\Users\hiramtan\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages - PackageReference - 5.11.1 - - - - - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - - \ No newline at end of file diff --git a/src/HiSocket.Tcp/obj/HiSocket.Tcp.csproj.nuget.g.targets b/src/HiSocket.Tcp/obj/HiSocket.Tcp.csproj.nuget.g.targets deleted file mode 100644 index 8f2d2d6..0000000 --- a/src/HiSocket.Tcp/obj/HiSocket.Tcp.csproj.nuget.g.targets +++ /dev/null @@ -1,9 +0,0 @@ - - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - - - - - \ No newline at end of file diff --git a/src/HiSocket.Tcp/obj/project.assets.json b/src/HiSocket.Tcp/obj/project.assets.json deleted file mode 100644 index c8a91a8..0000000 --- a/src/HiSocket.Tcp/obj/project.assets.json +++ /dev/null @@ -1,247 +0,0 @@ -{ - "version": 3, - "targets": { - ".NETStandard,Version=v2.0": { - "Microsoft.NETCore.Platforms/1.1.0": { - "type": "package", - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "NETStandard.Library/2.0.3": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - }, - "build": { - "build/netstandard2.0/NETStandard.Library.targets": {} - } - } - } - }, - "libraries": { - "Microsoft.NETCore.Platforms/1.1.0": { - "sha512": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==", - "type": "package", - "path": "microsoft.netcore.platforms/1.1.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "microsoft.netcore.platforms.1.1.0.nupkg.sha512", - "microsoft.netcore.platforms.nuspec", - "runtime.json" - ] - }, - "NETStandard.Library/2.0.3": { - "sha512": "st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==", - "type": "package", - "path": "netstandard.library/2.0.3", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "LICENSE.TXT", - "THIRD-PARTY-NOTICES.TXT", - "build/netstandard2.0/NETStandard.Library.targets", - "build/netstandard2.0/ref/Microsoft.Win32.Primitives.dll", - "build/netstandard2.0/ref/System.AppContext.dll", - "build/netstandard2.0/ref/System.Collections.Concurrent.dll", - "build/netstandard2.0/ref/System.Collections.NonGeneric.dll", - "build/netstandard2.0/ref/System.Collections.Specialized.dll", - "build/netstandard2.0/ref/System.Collections.dll", - "build/netstandard2.0/ref/System.ComponentModel.Composition.dll", - "build/netstandard2.0/ref/System.ComponentModel.EventBasedAsync.dll", - "build/netstandard2.0/ref/System.ComponentModel.Primitives.dll", - "build/netstandard2.0/ref/System.ComponentModel.TypeConverter.dll", - "build/netstandard2.0/ref/System.ComponentModel.dll", - "build/netstandard2.0/ref/System.Console.dll", - "build/netstandard2.0/ref/System.Core.dll", - "build/netstandard2.0/ref/System.Data.Common.dll", - "build/netstandard2.0/ref/System.Data.dll", - "build/netstandard2.0/ref/System.Diagnostics.Contracts.dll", - "build/netstandard2.0/ref/System.Diagnostics.Debug.dll", - "build/netstandard2.0/ref/System.Diagnostics.FileVersionInfo.dll", - "build/netstandard2.0/ref/System.Diagnostics.Process.dll", - "build/netstandard2.0/ref/System.Diagnostics.StackTrace.dll", - "build/netstandard2.0/ref/System.Diagnostics.TextWriterTraceListener.dll", - "build/netstandard2.0/ref/System.Diagnostics.Tools.dll", - "build/netstandard2.0/ref/System.Diagnostics.TraceSource.dll", - "build/netstandard2.0/ref/System.Diagnostics.Tracing.dll", - "build/netstandard2.0/ref/System.Drawing.Primitives.dll", - "build/netstandard2.0/ref/System.Drawing.dll", - "build/netstandard2.0/ref/System.Dynamic.Runtime.dll", - "build/netstandard2.0/ref/System.Globalization.Calendars.dll", - "build/netstandard2.0/ref/System.Globalization.Extensions.dll", - "build/netstandard2.0/ref/System.Globalization.dll", - "build/netstandard2.0/ref/System.IO.Compression.FileSystem.dll", - "build/netstandard2.0/ref/System.IO.Compression.ZipFile.dll", - "build/netstandard2.0/ref/System.IO.Compression.dll", - "build/netstandard2.0/ref/System.IO.FileSystem.DriveInfo.dll", - "build/netstandard2.0/ref/System.IO.FileSystem.Primitives.dll", - "build/netstandard2.0/ref/System.IO.FileSystem.Watcher.dll", - "build/netstandard2.0/ref/System.IO.FileSystem.dll", - "build/netstandard2.0/ref/System.IO.IsolatedStorage.dll", - "build/netstandard2.0/ref/System.IO.MemoryMappedFiles.dll", - "build/netstandard2.0/ref/System.IO.Pipes.dll", - "build/netstandard2.0/ref/System.IO.UnmanagedMemoryStream.dll", - "build/netstandard2.0/ref/System.IO.dll", - "build/netstandard2.0/ref/System.Linq.Expressions.dll", - "build/netstandard2.0/ref/System.Linq.Parallel.dll", - "build/netstandard2.0/ref/System.Linq.Queryable.dll", - "build/netstandard2.0/ref/System.Linq.dll", - "build/netstandard2.0/ref/System.Net.Http.dll", - "build/netstandard2.0/ref/System.Net.NameResolution.dll", - "build/netstandard2.0/ref/System.Net.NetworkInformation.dll", - "build/netstandard2.0/ref/System.Net.Ping.dll", - "build/netstandard2.0/ref/System.Net.Primitives.dll", - "build/netstandard2.0/ref/System.Net.Requests.dll", - "build/netstandard2.0/ref/System.Net.Security.dll", - "build/netstandard2.0/ref/System.Net.Sockets.dll", - "build/netstandard2.0/ref/System.Net.WebHeaderCollection.dll", - "build/netstandard2.0/ref/System.Net.WebSockets.Client.dll", - "build/netstandard2.0/ref/System.Net.WebSockets.dll", - "build/netstandard2.0/ref/System.Net.dll", - "build/netstandard2.0/ref/System.Numerics.dll", - "build/netstandard2.0/ref/System.ObjectModel.dll", - "build/netstandard2.0/ref/System.Reflection.Extensions.dll", - "build/netstandard2.0/ref/System.Reflection.Primitives.dll", - "build/netstandard2.0/ref/System.Reflection.dll", - "build/netstandard2.0/ref/System.Resources.Reader.dll", - "build/netstandard2.0/ref/System.Resources.ResourceManager.dll", - "build/netstandard2.0/ref/System.Resources.Writer.dll", - "build/netstandard2.0/ref/System.Runtime.CompilerServices.VisualC.dll", - "build/netstandard2.0/ref/System.Runtime.Extensions.dll", - "build/netstandard2.0/ref/System.Runtime.Handles.dll", - "build/netstandard2.0/ref/System.Runtime.InteropServices.RuntimeInformation.dll", - "build/netstandard2.0/ref/System.Runtime.InteropServices.dll", - "build/netstandard2.0/ref/System.Runtime.Numerics.dll", - "build/netstandard2.0/ref/System.Runtime.Serialization.Formatters.dll", - "build/netstandard2.0/ref/System.Runtime.Serialization.Json.dll", - "build/netstandard2.0/ref/System.Runtime.Serialization.Primitives.dll", - "build/netstandard2.0/ref/System.Runtime.Serialization.Xml.dll", - "build/netstandard2.0/ref/System.Runtime.Serialization.dll", - "build/netstandard2.0/ref/System.Runtime.dll", - "build/netstandard2.0/ref/System.Security.Claims.dll", - "build/netstandard2.0/ref/System.Security.Cryptography.Algorithms.dll", - "build/netstandard2.0/ref/System.Security.Cryptography.Csp.dll", - "build/netstandard2.0/ref/System.Security.Cryptography.Encoding.dll", - "build/netstandard2.0/ref/System.Security.Cryptography.Primitives.dll", - "build/netstandard2.0/ref/System.Security.Cryptography.X509Certificates.dll", - "build/netstandard2.0/ref/System.Security.Principal.dll", - "build/netstandard2.0/ref/System.Security.SecureString.dll", - "build/netstandard2.0/ref/System.ServiceModel.Web.dll", - "build/netstandard2.0/ref/System.Text.Encoding.Extensions.dll", - "build/netstandard2.0/ref/System.Text.Encoding.dll", - "build/netstandard2.0/ref/System.Text.RegularExpressions.dll", - "build/netstandard2.0/ref/System.Threading.Overlapped.dll", - "build/netstandard2.0/ref/System.Threading.Tasks.Parallel.dll", - "build/netstandard2.0/ref/System.Threading.Tasks.dll", - "build/netstandard2.0/ref/System.Threading.Thread.dll", - "build/netstandard2.0/ref/System.Threading.ThreadPool.dll", - "build/netstandard2.0/ref/System.Threading.Timer.dll", - "build/netstandard2.0/ref/System.Threading.dll", - "build/netstandard2.0/ref/System.Transactions.dll", - "build/netstandard2.0/ref/System.ValueTuple.dll", - "build/netstandard2.0/ref/System.Web.dll", - "build/netstandard2.0/ref/System.Windows.dll", - "build/netstandard2.0/ref/System.Xml.Linq.dll", - "build/netstandard2.0/ref/System.Xml.ReaderWriter.dll", - "build/netstandard2.0/ref/System.Xml.Serialization.dll", - "build/netstandard2.0/ref/System.Xml.XDocument.dll", - "build/netstandard2.0/ref/System.Xml.XPath.XDocument.dll", - "build/netstandard2.0/ref/System.Xml.XPath.dll", - "build/netstandard2.0/ref/System.Xml.XmlDocument.dll", - "build/netstandard2.0/ref/System.Xml.XmlSerializer.dll", - "build/netstandard2.0/ref/System.Xml.dll", - "build/netstandard2.0/ref/System.dll", - "build/netstandard2.0/ref/mscorlib.dll", - "build/netstandard2.0/ref/netstandard.dll", - "build/netstandard2.0/ref/netstandard.xml", - "lib/netstandard1.0/_._", - "netstandard.library.2.0.3.nupkg.sha512", - "netstandard.library.nuspec" - ] - } - }, - "projectFileDependencyGroups": { - ".NETStandard,Version=v2.0": [ - "NETStandard.Library >= 2.0.3" - ] - }, - "packageFolders": { - "C:\\Users\\hiramtan\\.nuget\\packages\\": {}, - "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages": {} - }, - "project": { - "version": "1.0.0", - "restore": { - "projectUniqueName": "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Tcp\\HiSocket.Tcp.csproj", - "projectName": "HiSocket.Tcp", - "projectPath": "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Tcp\\HiSocket.Tcp.csproj", - "packagesPath": "C:\\Users\\hiramtan\\.nuget\\packages\\", - "outputPath": "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Tcp\\obj\\", - "projectStyle": "PackageReference", - "fallbackFolders": [ - "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" - ], - "configFilePaths": [ - "C:\\Users\\hiramtan\\AppData\\Roaming\\NuGet\\NuGet.Config", - "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config", - "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" - ], - "originalTargetFrameworks": [ - "netstandard2.0" - ], - "sources": { - "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, - "https://api.nuget.org/v3/index.json": {} - }, - "frameworks": { - "netstandard2.0": { - "targetAlias": "netstandard2.0", - "projectReferences": {} - } - }, - "warningProperties": { - "warnAsError": [ - "NU1605" - ] - } - }, - "frameworks": { - "netstandard2.0": { - "targetAlias": "netstandard2.0", - "dependencies": { - "NETStandard.Library": { - "suppressParent": "All", - "target": "Package", - "version": "[2.0.3, )", - "autoReferenced": true - } - }, - "imports": [ - "net461", - "net462", - "net47", - "net471", - "net472", - "net48" - ], - "assetTargetFallback": true, - "warn": true, - "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.402\\RuntimeIdentifierGraph.json" - } - } - } -} \ No newline at end of file diff --git a/src/HiSocket.Tcp/obj/project.nuget.cache b/src/HiSocket.Tcp/obj/project.nuget.cache deleted file mode 100644 index 9308e1e..0000000 --- a/src/HiSocket.Tcp/obj/project.nuget.cache +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": 2, - "dgSpecHash": "oL4s5aLPX9mmRaakycDiDwnPGXeyVYev/KBIrF1u/sDRLUj4WMds9X6X+mYlzCI3ZpcRKpHR2zt7Igc4oKS49g==", - "success": true, - "projectFilePath": "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Tcp\\HiSocket.Tcp.csproj", - "expectedPackageFiles": [ - "C:\\Users\\hiramtan\\.nuget\\packages\\microsoft.netcore.platforms\\1.1.0\\microsoft.netcore.platforms.1.1.0.nupkg.sha512", - "C:\\Users\\hiramtan\\.nuget\\packages\\netstandard.library\\2.0.3\\netstandard.library.2.0.3.nupkg.sha512" - ], - "logs": [] -} \ No newline at end of file diff --git a/src/HiSocket.Udp.Example/Class1.cs b/src/HiSocket.Udp.Example/Class1.cs new file mode 100644 index 0000000..8f78f22 --- /dev/null +++ b/src/HiSocket.Udp.Example/Class1.cs @@ -0,0 +1,13 @@ +/*************************************************************** + * Description: Block buffer for reuse array + * + * Documents: https://github.com/hiram3512/HiSocket + * Support: hiramtan@live.com +***************************************************************/ + +namespace HiSocket.Udp.Example +{ + public class Class1 + { + } +} diff --git a/src/HiSocket.Udp.TestServer/HiSocket.Udp.TestServer.csproj b/src/HiSocket.Udp.Example/HiSocket.Udp.Example.csproj similarity index 79% rename from src/HiSocket.Udp.TestServer/HiSocket.Udp.TestServer.csproj rename to src/HiSocket.Udp.Example/HiSocket.Udp.Example.csproj index 2082704..f208d30 100644 --- a/src/HiSocket.Udp.TestServer/HiSocket.Udp.TestServer.csproj +++ b/src/HiSocket.Udp.Example/HiSocket.Udp.Example.csproj @@ -1,7 +1,6 @@ - Exe net5.0 diff --git a/src/HiSocket.Udp.Test/HiSocket.Udp.Test.csproj b/src/HiSocket.Udp.Test/HiSocket.Udp.Test.csproj new file mode 100644 index 0000000..5c45455 --- /dev/null +++ b/src/HiSocket.Udp.Test/HiSocket.Udp.Test.csproj @@ -0,0 +1,16 @@ + + + + net5.0 + + false + + + + + + + + + + diff --git a/src/HiSocket.Udp.Test/UnitTest1.cs b/src/HiSocket.Udp.Test/UnitTest1.cs new file mode 100644 index 0000000..4c2386f --- /dev/null +++ b/src/HiSocket.Udp.Test/UnitTest1.cs @@ -0,0 +1,20 @@ +/*************************************************************** + * Description: Block buffer for reuse array + * + * Documents: https://github.com/hiram3512/HiSocket + * Support: hiramtan@live.com +***************************************************************/ + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace HiSocket.Udp.Test +{ + [TestClass] + public class UnitTest1 + { + [TestMethod] + public void TestMethod1() + { + } + } +} diff --git a/src/HiSocket.Udp.TestServer/Program.cs b/src/HiSocket.Udp.TestServer/Program.cs deleted file mode 100644 index 4d21139..0000000 --- a/src/HiSocket.Udp.TestServer/Program.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace HiSocket.Udp.TestServer -{ - class Program - { - static void Main(string[] args) - { - Console.WriteLine("Hello World!"); - } - } -} diff --git a/src/HiSocket.Udp.TestServer/obj/Debug/net5.0/.NETCoreApp,Version=v5.0.AssemblyAttributes.cs b/src/HiSocket.Udp.TestServer/obj/Debug/net5.0/.NETCoreApp,Version=v5.0.AssemblyAttributes.cs deleted file mode 100644 index 2f7e5ec..0000000 --- a/src/HiSocket.Udp.TestServer/obj/Debug/net5.0/.NETCoreApp,Version=v5.0.AssemblyAttributes.cs +++ /dev/null @@ -1,4 +0,0 @@ -// -using System; -using System.Reflection; -[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v5.0", FrameworkDisplayName = "")] diff --git a/src/HiSocket.Udp.TestServer/obj/Debug/net5.0/HiSocket.Udp.TestServer.AssemblyInfo.cs b/src/HiSocket.Udp.TestServer/obj/Debug/net5.0/HiSocket.Udp.TestServer.AssemblyInfo.cs deleted file mode 100644 index 7459754..0000000 --- a/src/HiSocket.Udp.TestServer/obj/Debug/net5.0/HiSocket.Udp.TestServer.AssemblyInfo.cs +++ /dev/null @@ -1,23 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -using System; -using System.Reflection; - -[assembly: System.Reflection.AssemblyCompanyAttribute("HiSocket.Udp.TestServer")] -[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] -[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] -[assembly: System.Reflection.AssemblyProductAttribute("HiSocket.Udp.TestServer")] -[assembly: System.Reflection.AssemblyTitleAttribute("HiSocket.Udp.TestServer")] -[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] - -// Generated by the MSBuild WriteCodeFragment class. - diff --git a/src/HiSocket.Udp.TestServer/obj/Debug/net5.0/HiSocket.Udp.TestServer.AssemblyInfoInputs.cache b/src/HiSocket.Udp.TestServer/obj/Debug/net5.0/HiSocket.Udp.TestServer.AssemblyInfoInputs.cache deleted file mode 100644 index 26865ac..0000000 --- a/src/HiSocket.Udp.TestServer/obj/Debug/net5.0/HiSocket.Udp.TestServer.AssemblyInfoInputs.cache +++ /dev/null @@ -1 +0,0 @@ -ba4da49f600846351485b81a0cd11413e7f03474 diff --git a/src/HiSocket.Udp.TestServer/obj/Debug/net5.0/HiSocket.Udp.TestServer.GeneratedMSBuildEditorConfig.editorconfig b/src/HiSocket.Udp.TestServer/obj/Debug/net5.0/HiSocket.Udp.TestServer.GeneratedMSBuildEditorConfig.editorconfig deleted file mode 100644 index aed620b..0000000 --- a/src/HiSocket.Udp.TestServer/obj/Debug/net5.0/HiSocket.Udp.TestServer.GeneratedMSBuildEditorConfig.editorconfig +++ /dev/null @@ -1,10 +0,0 @@ -is_global = true -build_property.TargetFramework = net5.0 -build_property.TargetPlatformMinVersion = -build_property.UsingMicrosoftNETSdkWeb = -build_property.ProjectTypeGuids = -build_property.PublishSingleFile = -build_property.IncludeAllContentForSelfExtract = -build_property._SupportedPlatformList = Android,iOS,Linux,macOS,Windows -build_property.RootNamespace = HiSocket.Udp.TestServer -build_property.ProjectDir = D:\HiGit\GitHub\HiSocket\src\HiSocket.Udp.TestServer\ diff --git a/src/HiSocket.Udp.TestServer/obj/Debug/net5.0/HiSocket.Udp.TestServer.assets.cache b/src/HiSocket.Udp.TestServer/obj/Debug/net5.0/HiSocket.Udp.TestServer.assets.cache deleted file mode 100644 index 444099a..0000000 Binary files a/src/HiSocket.Udp.TestServer/obj/Debug/net5.0/HiSocket.Udp.TestServer.assets.cache and /dev/null differ diff --git a/src/HiSocket.Udp.TestServer/obj/Debug/net5.0/HiSocket.Udp.TestServer.csproj.AssemblyReference.cache b/src/HiSocket.Udp.TestServer/obj/Debug/net5.0/HiSocket.Udp.TestServer.csproj.AssemblyReference.cache deleted file mode 100644 index 22a214f..0000000 Binary files a/src/HiSocket.Udp.TestServer/obj/Debug/net5.0/HiSocket.Udp.TestServer.csproj.AssemblyReference.cache and /dev/null differ diff --git a/src/HiSocket.Udp.TestServer/obj/HiSocket.Udp.TestServer.csproj.nuget.dgspec.json b/src/HiSocket.Udp.TestServer/obj/HiSocket.Udp.TestServer.csproj.nuget.dgspec.json deleted file mode 100644 index f1db0b7..0000000 --- a/src/HiSocket.Udp.TestServer/obj/HiSocket.Udp.TestServer.csproj.nuget.dgspec.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "format": 1, - "restore": { - "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Udp.TestServer\\HiSocket.Udp.TestServer.csproj": {} - }, - "projects": { - "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Udp.TestServer\\HiSocket.Udp.TestServer.csproj": { - "version": "1.0.0", - "restore": { - "projectUniqueName": "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Udp.TestServer\\HiSocket.Udp.TestServer.csproj", - "projectName": "HiSocket.Udp.TestServer", - "projectPath": "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Udp.TestServer\\HiSocket.Udp.TestServer.csproj", - "packagesPath": "C:\\Users\\hiramtan\\.nuget\\packages\\", - "outputPath": "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Udp.TestServer\\obj\\", - "projectStyle": "PackageReference", - "fallbackFolders": [ - "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" - ], - "configFilePaths": [ - "C:\\Users\\hiramtan\\AppData\\Roaming\\NuGet\\NuGet.Config", - "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config", - "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" - ], - "originalTargetFrameworks": [ - "net5.0" - ], - "sources": { - "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, - "https://api.nuget.org/v3/index.json": {} - }, - "frameworks": { - "net5.0": { - "targetAlias": "net5.0", - "projectReferences": {} - } - }, - "warningProperties": { - "warnAsError": [ - "NU1605" - ] - } - }, - "frameworks": { - "net5.0": { - "targetAlias": "net5.0", - "imports": [ - "net461", - "net462", - "net47", - "net471", - "net472", - "net48" - ], - "assetTargetFallback": true, - "warn": true, - "frameworkReferences": { - "Microsoft.NETCore.App": { - "privateAssets": "all" - } - }, - "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.402\\RuntimeIdentifierGraph.json" - } - } - } - } -} \ No newline at end of file diff --git a/src/HiSocket.Udp.TestServer/obj/HiSocket.Udp.TestServer.csproj.nuget.g.props b/src/HiSocket.Udp.TestServer/obj/HiSocket.Udp.TestServer.csproj.nuget.g.props deleted file mode 100644 index 59f2fb5..0000000 --- a/src/HiSocket.Udp.TestServer/obj/HiSocket.Udp.TestServer.csproj.nuget.g.props +++ /dev/null @@ -1,19 +0,0 @@ - - - - True - NuGet - $(MSBuildThisFileDirectory)project.assets.json - $(UserProfile)\.nuget\packages\ - C:\Users\hiramtan\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages - PackageReference - 5.11.1 - - - - - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - - \ No newline at end of file diff --git a/src/HiSocket.Udp.TestServer/obj/HiSocket.Udp.TestServer.csproj.nuget.g.targets b/src/HiSocket.Udp.TestServer/obj/HiSocket.Udp.TestServer.csproj.nuget.g.targets deleted file mode 100644 index 53cfaa1..0000000 --- a/src/HiSocket.Udp.TestServer/obj/HiSocket.Udp.TestServer.csproj.nuget.g.targets +++ /dev/null @@ -1,6 +0,0 @@ - - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - - \ No newline at end of file diff --git a/src/HiSocket.Udp.TestServer/obj/project.assets.json b/src/HiSocket.Udp.TestServer/obj/project.assets.json deleted file mode 100644 index de63dcf..0000000 --- a/src/HiSocket.Udp.TestServer/obj/project.assets.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "version": 3, - "targets": { - "net5.0": {} - }, - "libraries": {}, - "projectFileDependencyGroups": { - "net5.0": [] - }, - "packageFolders": { - "C:\\Users\\hiramtan\\.nuget\\packages\\": {}, - "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages": {} - }, - "project": { - "version": "1.0.0", - "restore": { - "projectUniqueName": "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Udp.TestServer\\HiSocket.Udp.TestServer.csproj", - "projectName": "HiSocket.Udp.TestServer", - "projectPath": "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Udp.TestServer\\HiSocket.Udp.TestServer.csproj", - "packagesPath": "C:\\Users\\hiramtan\\.nuget\\packages\\", - "outputPath": "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Udp.TestServer\\obj\\", - "projectStyle": "PackageReference", - "fallbackFolders": [ - "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" - ], - "configFilePaths": [ - "C:\\Users\\hiramtan\\AppData\\Roaming\\NuGet\\NuGet.Config", - "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config", - "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" - ], - "originalTargetFrameworks": [ - "net5.0" - ], - "sources": { - "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, - "https://api.nuget.org/v3/index.json": {} - }, - "frameworks": { - "net5.0": { - "targetAlias": "net5.0", - "projectReferences": {} - } - }, - "warningProperties": { - "warnAsError": [ - "NU1605" - ] - } - }, - "frameworks": { - "net5.0": { - "targetAlias": "net5.0", - "imports": [ - "net461", - "net462", - "net47", - "net471", - "net472", - "net48" - ], - "assetTargetFallback": true, - "warn": true, - "frameworkReferences": { - "Microsoft.NETCore.App": { - "privateAssets": "all" - } - }, - "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.402\\RuntimeIdentifierGraph.json" - } - } - } -} \ No newline at end of file diff --git a/src/HiSocket.Udp.TestServer/obj/project.nuget.cache b/src/HiSocket.Udp.TestServer/obj/project.nuget.cache deleted file mode 100644 index 1cbda48..0000000 --- a/src/HiSocket.Udp.TestServer/obj/project.nuget.cache +++ /dev/null @@ -1,8 +0,0 @@ -{ - "version": 2, - "dgSpecHash": "h0x5ljdv4sc+owvECq6anRU20Q27yONVoMBiE4uJTWtMW2rFgW0gUkMJm/VEEkm6kNOBWou/Iiqj041sFCkhMg==", - "success": true, - "projectFilePath": "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Udp.TestServer\\HiSocket.Udp.TestServer.csproj", - "expectedPackageFiles": [], - "logs": [] -} \ No newline at end of file diff --git a/src/HiSocket.Udp/Class1.cs b/src/HiSocket.Udp/Class1.cs index 4fd4274..f951448 100644 --- a/src/HiSocket.Udp/Class1.cs +++ b/src/HiSocket.Udp/Class1.cs @@ -1,4 +1,9 @@ -using System; +/*************************************************************** + * Description: Block buffer for reuse array + * + * Documents: https://github.com/hiram3512/HiSocket + * Support: hiramtan@live.com +***************************************************************/ namespace HiSocket.Udp { diff --git a/src/HiSocket.Udp/HiSocket.Udp.csproj b/src/HiSocket.Udp/HiSocket.Udp.csproj index 9f5c4f4..c09b9fc 100644 --- a/src/HiSocket.Udp/HiSocket.Udp.csproj +++ b/src/HiSocket.Udp/HiSocket.Udp.csproj @@ -1,7 +1,8 @@ - + netstandard2.0 + true diff --git a/src/HiSocket.Udp/obj/Debug/netstandard2.0/HiSocket.Udp.GeneratedMSBuildEditorConfig.editorconfig b/src/HiSocket.Udp/obj/Debug/netstandard2.0/HiSocket.Udp.GeneratedMSBuildEditorConfig.editorconfig index 1794561..6d0a5fb 100644 --- a/src/HiSocket.Udp/obj/Debug/netstandard2.0/HiSocket.Udp.GeneratedMSBuildEditorConfig.editorconfig +++ b/src/HiSocket.Udp/obj/Debug/netstandard2.0/HiSocket.Udp.GeneratedMSBuildEditorConfig.editorconfig @@ -1,3 +1,3 @@ is_global = true build_property.RootNamespace = HiSocket.Udp -build_property.ProjectDir = D:\HiGit\GitHub\HiSocket\src\HiSocket.Udp\ +build_property.ProjectDir = F:\HiGit\GitHub\HiSocket\src\HiSocket.Udp\ diff --git a/src/HiSocket.Udp/obj/Debug/netstandard2.0/HiSocket.Udp.assets.cache b/src/HiSocket.Udp/obj/Debug/netstandard2.0/HiSocket.Udp.assets.cache index 314ec64..3d29092 100644 Binary files a/src/HiSocket.Udp/obj/Debug/netstandard2.0/HiSocket.Udp.assets.cache and b/src/HiSocket.Udp/obj/Debug/netstandard2.0/HiSocket.Udp.assets.cache differ diff --git a/src/HiSocket.Udp/obj/Debug/netstandard2.0/HiSocket.Udp.csproj.AssemblyReference.cache b/src/HiSocket.Udp/obj/Debug/netstandard2.0/HiSocket.Udp.csproj.AssemblyReference.cache index e28040a..f5e894a 100644 Binary files a/src/HiSocket.Udp/obj/Debug/netstandard2.0/HiSocket.Udp.csproj.AssemblyReference.cache and b/src/HiSocket.Udp/obj/Debug/netstandard2.0/HiSocket.Udp.csproj.AssemblyReference.cache differ diff --git a/src/HiSocket.Udp/obj/HiSocket.Udp.csproj.nuget.dgspec.json b/src/HiSocket.Udp/obj/HiSocket.Udp.csproj.nuget.dgspec.json index 0e7f035..cc10231 100644 --- a/src/HiSocket.Udp/obj/HiSocket.Udp.csproj.nuget.dgspec.json +++ b/src/HiSocket.Udp/obj/HiSocket.Udp.csproj.nuget.dgspec.json @@ -1,17 +1,17 @@ { "format": 1, "restore": { - "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Udp\\HiSocket.Udp.csproj": {} + "F:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Udp\\HiSocket.Udp.csproj": {} }, "projects": { - "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Udp\\HiSocket.Udp.csproj": { + "F:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Udp\\HiSocket.Udp.csproj": { "version": "1.0.0", "restore": { - "projectUniqueName": "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Udp\\HiSocket.Udp.csproj", + "projectUniqueName": "F:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Udp\\HiSocket.Udp.csproj", "projectName": "HiSocket.Udp", - "projectPath": "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Udp\\HiSocket.Udp.csproj", + "projectPath": "F:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Udp\\HiSocket.Udp.csproj", "packagesPath": "C:\\Users\\hiramtan\\.nuget\\packages\\", - "outputPath": "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Udp\\obj\\", + "outputPath": "F:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Udp\\obj\\", "projectStyle": "PackageReference", "fallbackFolders": [ "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" @@ -26,7 +26,8 @@ ], "sources": { "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, - "https://api.nuget.org/v3/index.json": {} + "https://api.nuget.org/v3/index.json": {}, + "https://github.com/OWNER/REPOSITORY": {} }, "frameworks": { "netstandard2.0": { diff --git a/src/HiSocket.Udp/obj/project.assets.json b/src/HiSocket.Udp/obj/project.assets.json index 52982bb..f5055ea 100644 --- a/src/HiSocket.Udp/obj/project.assets.json +++ b/src/HiSocket.Udp/obj/project.assets.json @@ -186,11 +186,11 @@ "project": { "version": "1.0.0", "restore": { - "projectUniqueName": "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Udp\\HiSocket.Udp.csproj", + "projectUniqueName": "F:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Udp\\HiSocket.Udp.csproj", "projectName": "HiSocket.Udp", - "projectPath": "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Udp\\HiSocket.Udp.csproj", + "projectPath": "F:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Udp\\HiSocket.Udp.csproj", "packagesPath": "C:\\Users\\hiramtan\\.nuget\\packages\\", - "outputPath": "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Udp\\obj\\", + "outputPath": "F:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Udp\\obj\\", "projectStyle": "PackageReference", "fallbackFolders": [ "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" @@ -205,7 +205,8 @@ ], "sources": { "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, - "https://api.nuget.org/v3/index.json": {} + "https://api.nuget.org/v3/index.json": {}, + "https://github.com/OWNER/REPOSITORY": {} }, "frameworks": { "netstandard2.0": { diff --git a/src/HiSocket.Udp/obj/project.nuget.cache b/src/HiSocket.Udp/obj/project.nuget.cache index b6e4df5..7902ca2 100644 --- a/src/HiSocket.Udp/obj/project.nuget.cache +++ b/src/HiSocket.Udp/obj/project.nuget.cache @@ -1,8 +1,8 @@ { "version": 2, - "dgSpecHash": "4nOwmfTJJvx2VScISv381TIarzdAx/Pk7p46T2MMnhqDIYxSLXPN8XUNTA+05vduVXmV7a0seBtkUkCqu2HpEQ==", + "dgSpecHash": "W8UKg3nOkEHmtPPexjl1cIDWdE4+DZcJ3MO16vnl4kUxYoSkArc/3+wWrMBgEKhIL2W7AOaUZ0sZxICYsOY35w==", "success": true, - "projectFilePath": "D:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Udp\\HiSocket.Udp.csproj", + "projectFilePath": "F:\\HiGit\\GitHub\\HiSocket\\src\\HiSocket.Udp\\HiSocket.Udp.csproj", "expectedPackageFiles": [ "C:\\Users\\hiramtan\\.nuget\\packages\\microsoft.netcore.platforms\\1.1.0\\microsoft.netcore.platforms.1.1.0.nupkg.sha512", "C:\\Users\\hiramtan\\.nuget\\packages\\netstandard.library\\2.0.3\\netstandard.library.2.0.3.nupkg.sha512" diff --git a/src/HiSocket.sln b/src/HiSocket.sln index d4438d4..34cae6e 100644 --- a/src/HiSocket.sln +++ b/src/HiSocket.sln @@ -5,13 +5,15 @@ VisualStudioVersion = 16.0.31729.503 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HiSocket.Tcp", "HiSocket.Tcp\HiSocket.Tcp.csproj", "{4C88ACD9-AC70-42D4-97D1-D0A4C0352B45}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CircularBuffer", "..\Submodule\CircularBuffer\CircularBuffer.csproj", "{83F16097-0115-4A15-9F0B-2639758640FF}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HiSocket.Udp", "HiSocket.Udp\HiSocket.Udp.csproj", "{707E7EBC-2A70-438E-8B2B-C0A424D12450}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HiSocket.Udp", "HiSocket.Udp\HiSocket.Udp.csproj", "{707E7EBC-2A70-438E-8B2B-C0A424D12450}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HiSocket.Tcp.Example", "HiSocket.Tcp.Example\HiSocket.Tcp.Example.csproj", "{44B60104-4FF1-4595-846D-C73886BED5DC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HiSocket.Tcp.TestServer", "HiSocket.Tcp.TestServer\HiSocket.Tcp.TestServer.csproj", "{4A800FC4-8D6F-4CD5-B323-505F090EBCAA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HiSocket.Tcp.Test", "HiSocket.Tcp.Test\HiSocket.Tcp.Test.csproj", "{7B0F5350-E242-49D3-AA17-BD1F6305C0F9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HiSocket.Udp.TestServer", "HiSocket.Udp.TestServer\HiSocket.Udp.TestServer.csproj", "{E5DDBCC5-AADF-49DF-BC49-AB5C5537A5A8}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HiSocket.Udp.Example", "HiSocket.Udp.Example\HiSocket.Udp.Example.csproj", "{CB9AA25A-874B-47EC-8184-F872C265C40A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HiSocket.Udp.Test", "HiSocket.Udp.Test\HiSocket.Udp.Test.csproj", "{BE3E3ABC-7477-4C44-BCD6-1AD99EEF0DA4}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -23,22 +25,26 @@ Global {4C88ACD9-AC70-42D4-97D1-D0A4C0352B45}.Debug|Any CPU.Build.0 = Debug|Any CPU {4C88ACD9-AC70-42D4-97D1-D0A4C0352B45}.Release|Any CPU.ActiveCfg = Release|Any CPU {4C88ACD9-AC70-42D4-97D1-D0A4C0352B45}.Release|Any CPU.Build.0 = Release|Any CPU - {83F16097-0115-4A15-9F0B-2639758640FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {83F16097-0115-4A15-9F0B-2639758640FF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {83F16097-0115-4A15-9F0B-2639758640FF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {83F16097-0115-4A15-9F0B-2639758640FF}.Release|Any CPU.Build.0 = Release|Any CPU {707E7EBC-2A70-438E-8B2B-C0A424D12450}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {707E7EBC-2A70-438E-8B2B-C0A424D12450}.Debug|Any CPU.Build.0 = Debug|Any CPU {707E7EBC-2A70-438E-8B2B-C0A424D12450}.Release|Any CPU.ActiveCfg = Release|Any CPU {707E7EBC-2A70-438E-8B2B-C0A424D12450}.Release|Any CPU.Build.0 = Release|Any CPU - {4A800FC4-8D6F-4CD5-B323-505F090EBCAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4A800FC4-8D6F-4CD5-B323-505F090EBCAA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4A800FC4-8D6F-4CD5-B323-505F090EBCAA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4A800FC4-8D6F-4CD5-B323-505F090EBCAA}.Release|Any CPU.Build.0 = Release|Any CPU - {E5DDBCC5-AADF-49DF-BC49-AB5C5537A5A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E5DDBCC5-AADF-49DF-BC49-AB5C5537A5A8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E5DDBCC5-AADF-49DF-BC49-AB5C5537A5A8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E5DDBCC5-AADF-49DF-BC49-AB5C5537A5A8}.Release|Any CPU.Build.0 = Release|Any CPU + {44B60104-4FF1-4595-846D-C73886BED5DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {44B60104-4FF1-4595-846D-C73886BED5DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {44B60104-4FF1-4595-846D-C73886BED5DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {44B60104-4FF1-4595-846D-C73886BED5DC}.Release|Any CPU.Build.0 = Release|Any CPU + {7B0F5350-E242-49D3-AA17-BD1F6305C0F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7B0F5350-E242-49D3-AA17-BD1F6305C0F9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7B0F5350-E242-49D3-AA17-BD1F6305C0F9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7B0F5350-E242-49D3-AA17-BD1F6305C0F9}.Release|Any CPU.Build.0 = Release|Any CPU + {CB9AA25A-874B-47EC-8184-F872C265C40A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CB9AA25A-874B-47EC-8184-F872C265C40A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CB9AA25A-874B-47EC-8184-F872C265C40A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CB9AA25A-874B-47EC-8184-F872C265C40A}.Release|Any CPU.Build.0 = Release|Any CPU + {BE3E3ABC-7477-4C44-BCD6-1AD99EEF0DA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BE3E3ABC-7477-4C44-BCD6-1AD99EEF0DA4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BE3E3ABC-7477-4C44-BCD6-1AD99EEF0DA4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BE3E3ABC-7477-4C44-BCD6-1AD99EEF0DA4}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE