Skip to content
onovichPublic

About

A Lightweight Networking Library Based On Socket And TCP

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

61 Commits

Folders and files

Repository files navigation

Rill

简体中文

Rill is a lightweight C# TCP client and server library with typed messages, background socket work, and main-thread message dispatch through an explicit tick.

Rill cover

What Rill does

  • Provides client connect, send, receive, disconnect, and error events.
  • Provides a TCP server with connection objects and per-client message delivery.
  • Registers message types that implement IMessage and serialize through LitIO.
  • Moves socket work off the caller thread and drains deserialized messages during Tick.
  • Exposes no-delay, send timeout, receive timeout, and buffer-length settings.

Installation

Rill depends on LitIO. Add LitIO first:

https://github.com/onovich/LitIO.git?path=/Assets/com.mortise.litio#main

Then add Rill through Window → Package Manager → Add package from git URL:

https://github.com/onovich/Rill.git?path=/Assets/com.mortise.rill#main

The package metadata declares Unity 2019.4 or later. The included project uses Unity 2022.3.13f1c1.

Quick start

using MortiseFrame.Rill;
using UnityEngine;

public sealed class ClientSample : MonoBehaviour {
    ClientCore client;

    void Start() {
        client = new ClientCore();
        client.OnConnect(() => Debug.Log("Connected"));
        client.OnDisconnect(() => Debug.Log("Disconnected"));
        client.OnError(message => Debug.LogError(message));
        client.Connect("127.0.0.1", 7777);
    }

    void Update() {
        client.Tick(Time.deltaTime);
    }

    void OnDestroy() {
        client?.Stop();
    }
}

Register every concrete IMessage type before sending or receiving it. The repository sample includes matching client, server, and message implementations.

Important limitation

The server does not currently enforce a maximum incoming message size. Do not expose Rill directly to untrusted public traffic until framing limits, malformed-message handling, and load behavior have been hardened and tested.

Status

The core client/server loop, typed messages, events, and configuration are implemented. Rill has been used in the experimental Ping client and Ping server, but it has not been validated for commercial production.

The current package version is 0.1.5. The repository has no automated integration or security test suite.

Development

Runtime code lives in Assets/com.mortise.rill/Scripts_Runtime/; the compact reference implementation lives in Assets/com.mortise.rill/Resource_Sample/.

License

MIT

About

A Lightweight Networking Library Based On Socket And TCP

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages