ConnectX.Client
2025.850.119
dotnet add package ConnectX.Client --version 2025.850.119
NuGet\Install-Package ConnectX.Client -Version 2025.850.119
<PackageReference Include="ConnectX.Client" Version="2025.850.119" />
<PackageVersion Include="ConnectX.Client" Version="2025.850.119" />
<PackageReference Include="ConnectX.Client" />
paket add ConnectX.Client --version 2025.850.119
#r "nuget: ConnectX.Client, 2025.850.119"
#:package ConnectX.Client@2025.850.119
#addin nuget:?package=ConnectX.Client&version=2025.850.119
#tool nuget:?package=ConnectX.Client&version=2025.850.119
ConnectX
A cross-platform Minecraft P2P online multi-player library in C#, developed using high-performance sockets for excellent forwarding performance, with P2P powered by the Zerotier SDK.
Proudly powered by another of our open-source projects: Hive.Framework
Architecture
Status
Function | Status |
---|---|
Server : Log Room Ops Info to local DB |
:white_check_mark: |
Server : Client/Room management |
:white_check_mark: |
Server : Relay Server management |
:white_check_mark: |
Relay : Relay Server impl based on Hive |
:white_check_mark: |
Relay : Ultra low latency relay impl |
:white_check_mark: |
Client : ZT based P2P connection |
:white_check_mark: |
Client : ZT based Relay connection |
:white_check_mark: |
Client : ConnectX based Relay connection |
:white_check_mark: |
Dual Stack Socket Support | :white_check_mark: |
Quick Start!
We are using the MSDI(Microsoft.Extensions.DependencyInjection) as our DI container. The best practice is to use .NET Generic Host
for you program.
First, add the following method for the Server Config. ConnectXServerIp
will be the Backend address for the ConnectX.Server.
private static IClientSettingProvider GetConnectXSettings()
{
var serverIp = IPAddress.None;
try
{
var ips = Dns.GetHostAddresses(ConnectXServerIp);
var ipv4Addresses = ips
.Where(ip => ip.AddressFamily == AddressFamily.InterNetwork)
.Where(ip => !ip.IsLocalIpAddress())
.ToArray();
if (ipv4Addresses.Length > 0)
serverIp = ipv4Addresses[0];
}
catch (Exception ex)
{
Log.Logger.Error(ex, "Failed to resolve ConnectX server IP.");
}
return new DefaultClientSettingProvider
{
ServerAddress = serverIp,
ServerPort = ConnectXServerPort,
JoinP2PNetwork = true
};
}
Then, just add one more line to complete the setup!
private static void ConfigureServices(IServiceCollection services)
{
// ...
+ services.UseConnectX(GetConnectXSettings);
// ...
}
How to use?
Inject IServerLinkHolder
and Client
into the VM where you want to manage the room instances.
Connect to the server
await _serverLinkHolder.ConnectAsync(CancellationToken.None);
Perform room actions
Please make sure that before you perform any room operations, you need to make sure you already connected to the ConnectX server!
await TaskHelper.WaitUntilAsync(() => _serverLinkHolder is { IsConnected: true, IsSignedIn: true });
var message = new CreateGroup
{
UserId = _serverLinkHolder.UserId,
RoomName = createRoomRecord.RoomName,
RoomDescription = createRoomRecord.RoomDescription,
RoomPassword = createRoomRecord.RoomPassword,
IsPrivate = createRoomRecord.IsPrivateRoom,
MaxUserCount = 3
};
var (groupInfo, status, err) = await _multiPlayerClient.CreateGroupAsync(message, CancellationToken.None);
if (groupInfo == null || status != GroupCreationStatus.Succeeded || !string.IsNullOrEmpty(err))
{
// Error process
return;
}
_multiPlayerClient.OnGroupStateChanged += MultiPlayerClientOnGroupStateChanged;
// Other actions
License
MIT. This means that you can modify or use our code for any purpose, however, copyright notice and permission notice shall be included in all copies or substantial portions of your software.
Stats
Disclaimer
ConnectX is not affiliated with Mojang or any part of its software.
Hall of Shame
Here, we'll list all programs using our code without obeying the MIT License.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- CommunityToolkit.HighPerformance (>= 8.4.0)
- ConnectX.Shared (>= 2025.850.119)
- Hive.Both.General (>= 2.25.4.15)
- Hive.Codec.MemoryPack (>= 2.25.4.15)
- Hive.Codec.Shared (>= 2.25.4.15)
- Hive.Network.Abstractions (>= 2.25.4.15)
- Hive.Network.Shared (>= 2.25.4.15)
- Hive.Network.Tcp (>= 2.25.4.15)
- Hive.Network.Udp (>= 2.25.4.15)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.4)
- ZeroTier.Sockets (>= 1.8.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.