Coder Social home page Coder Social logo

networker's Introduction

Build status NuGet

Networker

A simple to use TCP and UDP networking library for .NET, designed to be flexible, scalable and FAST.

Supported Frameworks

  • .NET Standard 2.0

Features

Installation

V3 is currently in pre-release. Get the latest build below. NuGet Package Manager

Install-Package Networker -IncludePrerelease

You must then install one of the following formatters

ZeroFormatter

Networker.Formatter.ZeroFormatter

Install-Package Networker.Formatter.ZeroFormatter

Protobuf-net

Networker.Formatter.ProtoBufNet

Install-Package Networker.Formatter.ProtoBufNet

Tutorial - Creating a Basic Unity Multiplayer Game with Networker

Get started with this tutorial written by the library developer Mark Eastwood

Example

Creating a server is easy..

var server = new ServerBuilder()
                .UseTcp(1000)
                .UseUdp(5000)
                .RegisterPacketHandlerModule<DefaultPacketHandlerModule>()
                .RegisterPacketHandlerModule<ExamplePacketHandlerModule>()
                .UseZeroFormatter()
                .ConfigureLogging(loggingBuilder =>
                                    {
                                        loggingBuilder.AddConsole();
                                        loggingBuilder.SetMinimumLevel(
                                            LogLevel.Debug);
                                    })
                .Build();

server.Start();

You can handle a packet easily using dependency injection, logging and built-in deserialisation.

public class PingPacketHandler : PacketHandlerBase<PingPacket>
{
    private readonly ILogger logger;

    public PingPacketHandler(ILogger<PingPacketHandler> logger)
    {
        this.logger = logger;
    }

    public override async Task Process(PingPacket packet, ISender sender)
    {
        this.logger.Debug("Received a ping packet from " + sender.EndPoint);
    }
}

Older Versions

Version 3 included a large rewrite and various breaking changes. To use V2 please see V2 Branch

networker's People

Contributors

markiodev avatar morganmoon avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.