xnetlib.replika
1.0.1
dotnet add package xnetlib.replika --version 1.0.1
NuGet\Install-Package xnetlib.replika -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="xnetlib.replika" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add xnetlib.replika --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: xnetlib.replika, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install xnetlib.replika as a Cake Addin #addin nuget:?package=xnetlib.replika&version=1.0.1 // Install xnetlib.replika as a Cake Tool #tool nuget:?package=xnetlib.replika&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Xnet library
This is a useful library that helps you write server/client apps with very simple code.
How to install
.NET CLI
:dotnet add package xnetlib --version 1.0.0
- Package Manager:
NuGet\Install-Package xnetlib -Version 1.0.0
- Package Reference:
<PackageReference Include="xnetlib" Version="1.0.0" />
Simple Example
The code below is everything.
class MyPacketProvider : Xnet.BasicPacketProvider<MyPacketProvider>
{
/// <summary>
/// Test packet.
/// </summary>
private class PACKET : Xnet.BasicPacket
{
public override Task ExecuteAsync(Xnet Connection)
{
Console.WriteLine(Connection.IsServerMode
? "SERVER RECEIVED: PACKET!"
: "CLIENT RECEIVED: PACKET!");
return Connection.EmitAsync(this);
}
protected override void Decode(BinaryReader Reader)
{
}
protected override void Encode(BinaryWriter Writer)
{
}
}
/// <inheritdoc/>
protected override void MapTypes()
{
Map<PACKET>("test");
}
}
// ---
var Options = new Xnet.ServerOptions();
Options.Endpoint = new IPEndPoint(IPAddress.Any, 7800);
Options.NetworkId = Guid.Empty;
Options.PacketProviders.Add(new Program());
var Services = new ServiceCollection();
using var Provider = Services.BuildServiceProvider();
await Xnet.Server(Provider, Options, Token);
Clients can be implemented in exactly the same way, except that they use Xnet.ClientOptions and Xnet.Client methods for options.
To go more deeper...
Read Xnet/Xnet.Options.cs
, Xnet/Xnet.Server.cs
and Xnet/Xnet.Client.cs
files.
The comments on the Options class and derived classes included in these files will help you understand.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net7.0
- Newtonsoft.Json.Bson (>= 1.0.2)
- xnetlib (>= 1.0.0)
- xnetlib.dsa (>= 1.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.1 | 196 | 10/20/2023 |