Nethostfire
Nethostfire is a UDP server/client created with C# (netstandard2.1), it's a simple and easy to understand project, with it you can set up your game server, video calls, file transfers and more.
Install / Use
/learn @treviasxk/NethostfireREADME
Nethostfire

Nethostfire is a library (netstandard2.1) designed to create UDP servers and clients in C#, with support for encryption, Unity 3D integration, and advanced features to facilitate communication between clients and servers.

Features
- Encryption Support: Includes RSA, AES, and Base64 encryption for secure communication.
- Unity 3D Integration: Adapted for Unity 3D projects, including support for Enter Play Mode and dedicated Unity server builds.
- High Performance: Optimized for high-performance networking.
- Cross-Server Communication: Supports creating cross-server communication systems.
- Packet Loss Prevention: Features to send UDP packets without losses or in an enqueued manner.
- Client and Server Management: Tools to manage connected clients and server sessions.
Getting Started
Installation for Unity 3D Projects
- Download the Nethostfire.dll from the Releases page.
- Place the file in your Unity project's
Assets/plugins/folder. - Import the namespace in your scripts:
using Nethostfire;
Installation for .NET Projects
- Download the Nethostfire.dll from the Releases page.
- Place the file in the root folder of your .NET project.
- Add the following to your .csproj file:
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<Reference Include="Nethostfire.dll"></Reference>
</ItemGroup>
...
</Project>
Installation for NuGet
Official Nethostfire NuGet page, you can find it here or use the command line below to add package in project.
dotnet add package Nethostfire --version 0.9.7
Usage
Creating a Server
using System.Net;
using Nethostfire.UDP;
var server = new Server();
server.Start(IPAddress.Any, 25000);
server.DataReceived += (sender, args) => {
Console.WriteLine($"Received data: {Encoding.UTF8.GetString(args.Data)}");
};
Creating a Client
using System.Net;
using Nethostfire.UDP;
var client = new Client();
client.Connect(IPAddress.Loopback, 25000);
client.DataReceived += (sender, args) => {
Console.WriteLine($"Received data: {Encoding.UTF8.GetString(args.Data)}");
};
client.Send("Hello, Server!", 0);
Advanced Features
TypeEncrypt
The TypeEncrypt enum allows you to define how data is encrypted when being sent over the network. This ensures secure communication between clients and servers. Below are the available encryption types:
- None: The data is sent without any encryption.
- AES: The data is encrypted using AES (Advanced Encryption Standard) and automatically decrypted upon reaching its destination.
- RSA: The data is encrypted using RSA (Rivest–Shamir–Adleman) and automatically decrypted upon reaching its destination.
- Base64: The data is encoded in Base64 format and automatically decoded upon reaching its destination.
- Compress: The data is compressed before being sent and automatically decompressed upon reaching its destination.
- OnlyBase64: The data is encoded in Base64 format, but if the destination is a server, it will not be decoded.
- OnlyCompress: The data is compressed, but if the destination is a server, it will not be decompressed.
Example: Sending Packets with TypeEncrypt
// Sending a packet without encryption
client.Send("Plain Message", 1, TypeEncrypt.None);
// Sending a packet encrypted with AES
client.Send("Secure Message", 1, TypeEncrypt.AES);
// Sending a packet compressed
client.Send("Compressed Message", 1, TypeEncrypt.Compress);
TypeShipping
The TypeShipping enum allows you to define how UDP packets are sent and handled, providing options for reliability and performance. Below are the available modes:
- None: No special handling is applied to the packet.
- WithoutPacketLoss: Ensures packets are delivered without loss but does not queue them for order.
- WithoutPacketLossEnqueue: Ensures packets are delivered without loss and queues them to maintain order. Not recommended for high-demand scenarios due to potential delays.
Example: Sending Packets with TypeShipping
// Sending a packet without packet loss
client.Send("Reliable Message", 1, TypeEncrypt.None, TypeShipping.WithoutPacketLoss);
// Sending a packet without packet loss and with queuing
client.Send("Ordered Reliable Message", 1, TypeEncrypt.None, TypeShipping.WithoutPacketLossEnqueue);
Contribute
Contributions are welcome! You can fork the repository and submit a pull request or sponsor the project to support its development.
- Github: Sponsor
- Paypal: trevias@live.com
Related Skills
qqbot-channel
347.2kQQ 频道管理技能。查询频道列表、子频道、成员、发帖、公告、日程等操作。使用 qqbot_channel_api 工具代理 QQ 开放平台 HTTP 接口,自动处理 Token 鉴权。当用户需要查看频道、管理子频道、查询成员、发布帖子/公告/日程时使用。
docs-writer
100.1k`docs-writer` skill instructions As an expert technical writer and editor for the Gemini CLI project, you produce accurate, clear, and consistent documentation. When asked to write, edit, or revie
model-usage
347.2kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
Design
Campus Second-Hand Trading Platform \- General Design Document (v5.0 \- React Architecture \- Complete Final Version)1\. System Overall Design 1.1. Project Overview This project aims t
