Skip to content

a lightweight Udp Server/Client for Unity and any C# (or .Net) project.

Notifications You must be signed in to change notification settings

huodianyan/Poly.Udp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Poly.Udp

a lightweight Udp Server/Client for Unity and any C# (or .Net) project.

Features

  • Zero dependencies
  • Minimal core (< 1000 lines)
  • Lightweight and fast
  • Support Reliable/Ordered transport
  • Simple fast byte array pool
  • Adapted to all C# game engine

Installation

Overview

server = new PolyUdpServer();
server.Start(address, port);
server.OnConnectEvent += (connId) => Console.WriteLine($"OnServerConnect: {connId}");
server.OnDisconnectEvent += (connId) => Console.WriteLine($"OnServerDisconnect: {connId}");
server.OnReceiveEvent += (connId, segment, method) =>
{
    var text = Encoding.ASCII.GetString(segment.Array, segment.Offset, segment.Count);
    server.Send(connId, $"Resp: {text}");
};

client = new PolyUdpClient();
client.Connect(address, port);
client.OnConnectEvent += (connId) => { Console.WriteLine($"OnClientConnect: {connId}"); };
client.OnDisconnectEvent += (connId) => Console.WriteLine($"OnClientDisconnect: {connId}");
client.OnReceiveEvent += (connId, segment, method) =>
{
    var text = Encoding.ASCII.GetString(segment.Array, segment.Offset, segment.Count);
    Console.WriteLine($"OnClientRecieve: {connId}, {text}");
};
client.Disconnect();
server.Stop();

License

The software is released under the terms of the MIT license.

FAQ

References

Documents

Projects

Benchmarks

About

a lightweight Udp Server/Client for Unity and any C# (or .Net) project.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages