NetSharp

NetSharp.git
git clone git://git.lenczewski.org/NetSharp.git
Log | Files | Refs | README | LICENSE

README.md.old (4615B)


      1 # NetSharp
      2 
      3 A networking library written in C#, focusing on performance and built on top of SocketAsyncEventArgs.
      4 
      5 It is geared towards asynchronous and highly concurrent applications, which aim for maximum bandwidth.
      6 
      7 For help with the library, feel free to visit our Discord and ask any questions [here](https://discord.gg/DKQhxuY).
      8 
      9 | Service | Status Badge |
     10 | ------- | ------------ |
     11 | Discord | [![Discord Server][discord-server-badge]](https://discord.gg/DKQhxuY) |
     12 | Code Quality | [![CodeFactor](https://www.codefactor.io/repository/github/mblenczewski/netsharp/badge/master)](https://www.codefactor.io/repository/github/mblenczewski/netsharp/overview/master) |
     13 | CI Build | [![Build Status](https://quartzstudios.visualstudio.com/NetSharp/_apis/build/status/mblenczewski.NetSharp?branchName=master)](https://quartzstudios.visualstudio.com/NetSharp/_build/latest?definitionId=7&branchName=master) |
     14 
     15 The latest release build can be used by searching for NetSharp in the NuGet package manager.
     16 
     17 The latest unstable build, built from master at the time of the last commit, can be used either by adding the following XML snippet to your nuget.config (in the same folder as your .csproj or .sln) and restoring the package index:
     18 
     19 ```xml
     20 <?xml version="1.0" encoding="utf-8"?>
     21 <configuration>
     22   <packageSources>
     23     <add key="NetSharpFeed" value="https://quartzstudios.pkgs.visualstudio.com/NetSharp/_packaging/NetSharpFeed/nuget/v3/index.json" />
     24   </packageSources>
     25 </configuration>
     26 ```
     27 
     28 Or by adding the following package source in Visual Studio, with the source name 'NetSharpFeed' and source url 'https://quartzstudios.pkgs.visualstudio.com/NetSharp/_packaging/NetSharpFeed/nuget/v3/index.json', under Tools > Options > NuGet Package Manager > Package Sources.
     29 
     30 ## Examples & Benchmarks
     31 
     32 The library comes with a .NET Core 3.1 console project containing examples and benchmarks for the components of the library. The example project and a few benchmarks can be seen below:
     33 
     34 ### Example Project
     35 
     36 ![Example Project 'Main Menu'][example-project]
     37 
     38 ### Benchmarks
     39 
     40 #### Preface
     41 
     42 All the benchmarks were performed on a Ryzen 7 1700 CPU @ 3.20GHz. This library is built to be concurrent and to scale well with the number of execution threads available. The per-core clocks are also important though (when are they not?).
     43 
     44 During a benchmark 1,000,000 packets are sent per client by default, with a data segment size of 8192 bytes (8 kibibytes). This means that, by default, 8.192 gigabytes of user data are sent one way, and 8.192 are received (in the form of a response packet). The server is set up to simply echo any received packets, so packet processing overhead is virtually non-existent. Your mileage may vary.
     45 
     46 The RTT values measured are the very extremes of what you would get. When printing the RTT-per-packet, the maximum value is attained at the start of the connection and the minimum value seems to be sustained for the remainder of the connection. Again, your mileage may vary depending on the speed of your network, your packet loss (if using TCP), and the amount of packet processing you do on the server. The more processing you do, the longer your RTT times will be.
     47 
     48 ### Datagram Network Reader & Writer Benchmarks
     49 
     50 The following is the datagram network listener (UDP) benchmark:
     51 
     52 ![Datagram Network Reader Benchmark][datagram-network-reader-benchmark]
     53 
     54 The following are the synchronous and asynchronous datagram network writer (UDP) benchmarks. Worse performance is expected when compared to the synchronous benchmark, due to the increased overhead of async operations:
     55 
     56 ![Datagram Network Writer Benchmark][datagram-network-writer-benchmark]
     57 
     58 ### Stream Network Reader & Writer Benchmarks
     59 
     60 The following is the stream network listener (TCP) benchmark:
     61 
     62 ![Stream Network Reader Benchmark][stream-network-reader-benchmark]
     63 
     64 The following are the synchronous and asynchronous stream network writer (TCP) benchmarks. Worse performance is expected when compared to the synchronous benchmark, due to the increased overhead of async operations:
     65 
     66 ![Stream Network Writer Benchmark][stream-network-writer-benchmark]
     67 
     68 [discord-server-badge]: https://img.shields.io/discord/703255900600795196.svg?style=flat-square&logo=discord&color=blue
     69 
     70 [example-project]: docs/example-selector.png
     71 
     72 [datagram-network-reader-benchmark]: docs/datagram-network-reader-benchmark.png
     73 [datagram-network-writer-benchmark]: docs/datagram-network-writer-benchmark.png
     74 
     75 [stream-network-reader-benchmark]: docs/stream-network-reader-benchmark.png
     76 [stream-network-writer-benchmark]: docs/stream-network-writer-benchmark.png