A lightweight network library written in C#
NetRoad helps developers to easily use sockets in their project.
With minimal code you can connect to a TCP or UDP server or host one yourself.
The library is lightweight (16.3kb), easy to use and very developer friendly.
- TCP Support
- Client
- Server
- UDP Support
- Client
- Server (Soon accessible)
- Data
- Integrated listener in client (NRoadTcpClient)
- Automatic encode data
- Send Object as JSON
- Events
- Connected (TCP)
- Disconnected (TCP)
- DataReceived (TCP/UDP)
// Connection credentials
string address = "127.0.0.1";
int port = 2299;
Encoding encoding = Encoding.UTF8;
// Create NRoad Client
var client = new NRoadTcpClient(address, port, encoding);
// Connect to server
client.Connect();
// Send data to server
int dataTimeout = 500;
client.Send("This is NetRoad!", 500);
// Disconnect client
client.Disconnect();
// Server credentials
string address = "127.0.0.1";
int port = 2299;
Encoding encoding = Encoding.UTF8;
// Create NRoad Server
var server = new NRoadTcpServer(address, port, encoding);
// Register Data Receive Event
server.DataReceived += (sender, s)
=> Console.WriteLine("Data:\t" + s);
// Start listening
server.Start();
.NET CLI
dotnet add package NetRoad
NuGet Gallery: https://www.nuget.org/packages/NetRoad
Dependency | Description | Version | License |
---|---|---|---|
Newtonsoft.Json@^13.0.1 | Json.NET is a popular high-performance JSON framework for .NET | 13.0.1 | MIT |
MIT License: https://choosealicense.com/licenses/mit
Discord: TimFvb#9999