Skip to content

Commit fc20c81

Browse files
Update README.md
1 parent 6d7790f commit fc20c81

File tree

1 file changed

+32
-28
lines changed

1 file changed

+32
-28
lines changed

README.md

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
# Standard Network Library
2-
High Performance, easy to use, network library supporting 16k+ concurrent clients.
2+
High Performance, easy to use network library supporting 16k+ concurrent clients.
33
Provides infrastructure for high throughput message passing, P2P, Nat Traversal, Reliable Udp.
4-
</br>This repository consist one main assembly and several serialization spesific implemtation assemblies.
5-
## Main Assembly
4+
</br>This repository consist one main core assembly and several serialization spesific implementation assemblies.
5+
## Core Network Liblary
66
Network Library, which is the core of entire network library. It has all the logic associated with the network system and sub systems, starting from raw bytes to abstractions such as P2P lobbies. It provides generic templates to be used with any serialization methodology.
77

88
### Core Models
9-
Plug&Play models, working with raw bytes.
10-
- ```Tcp Server/Client model``` with dynamic buffering and queuing sub systems, bytes can come fragmented like regular sockets.
11-
- ```Tcp Byte Message Server/Client``` model where bytes are sent with 4 byte lenght header. It ensure atomic message delivery without fragmentation.
12-
- ```Udp Server/Client``` models optimised for performance.
13-
- ```Reliable Udp Client/Server``` models where modern TCP protocol is implemented over Udp.
9+
Plug&Play high performance models, working with raw bytes.
10+
- ```Tcp Server/Client model``` with dynamic buffering and queueing sub systems, bytes can come fragmented like regular sockets.
11+
- ```Tcp Byte Message Server/Client``` where bytes are sent with 4 byte lenght header. It ensure atomic message delivery without fragmentation.
12+
- ```Udp Server/Client``` standard udp with optimised for performance.
13+
- ```Reliable Udp Client/Server``` where modern TCP protocol is implemented over Udp.
1414
- Secure variants of all of the above(SSL with TLS for Tcp, Symetric Key AES for Udp).
1515

1616
### Templates
17-
Involves generic clases which works with any serialization protocol.
18-
- ```Generic Message Server/Client``` model which send and receives serialized messages atomically.
19-
- ```Generic MessageProtocol Server/client``` model, similar to above, but with addition of "MessageEnvelope" carrier class, used as header/metadata.
20-
- ```P2P Relay Client/Server``` Model where Peers(Clients) discover each other via Relay server, can use Udp/Tcp to communicate. Supports Udp Holepunch.
21-
- ```P2P Room/Lobby Server/Client```, extention of Relay model where peers can define a room, similar to game matchmaking servers.
17+
Involves generic models which can work with any serialization protocol.
18+
- ```Generic Message Server/Client``` designed to send and receive serialized messages atomically.
19+
- ```Generic MessageProtocol Server/client``` similar to above, but with addition of "MessageEnvelope" carrier class, used as header/metadata.
20+
- ```P2P Relay Client/Server``` where Peers(Clients) discover each other via Relay server, can use Udp/Rudp/Tcp to communicate. Supports Udp Holepunch.
21+
- ```P2P Room/Lobby Server/Client``` extention of Relay model where peers can define a room, similar to game matchmaking servers.
2222

2323
### Low Level Features
2424

2525
#### Advanced Memory Management
26-
- Library implements "Shared Thread Local Memory Pool", where all byte arrays and the stream backing buffers are rented from. Memory is weak referenced. Pool provides minimum GC cycles and automatically trims on system memory pressure.
27-
- As an example, RelayServer can relay 21 Gigabytes/s Udp traffic using 36 mb process memory with 0 GC Collects.
26+
- Library implements "Shared Thread Local Memory Pool", where all byte arrays and the stream backing buffers are rented from. Memory is weak referenced. Pool allows minimum number GC cycles and automatically trims on system memory pressure.
27+
- As an example, RelayServer can relay 21 Gigabyte/s Udp traffic using 36 mb process memory with 0 GC Collects.
2828

2929
#### Message Buffering
30-
- Since the System calls for socket operations are rather expensive, on Tcp models a buffering/queueing system is implemented. This system is active only during high load.
30+
- Tcp models a buffering/queueing system is implemented. This system is activated only during high load.
3131
In a nutsell, if the socket is busy sending, next messages are collected and stiched together and sent as batch when the socket becomes available again. Its like Naggle, but without sacrificing the fast sends on moderate traffic.
32-
- This improves the throughput of small messages quite significantly which will be shown on benchmarks.
32+
- This improves the throughput of small messages quite significantly as shown on benchmarks.
3333

3434
Library is tested with as many clients as OS(Windows) supports (around 16k dynamic ports). Data reliability(includung RUDP) is tested over the internet extensively.
3535
Nat Traversal Udp holepunching is also tested over the internet with great success.
@@ -48,7 +48,7 @@ It includes:
4848
- .NET Standard 2.0+
4949

5050
Nuget Packages are available:
51-
|Core Network Library| Protobuf Network Library|MessagePack Network Library|NetSeralizer Network Library|Json Network Library|
51+
|Core Network Library| Protobuf|MessagePack |NetSeralizer|Json |
5252
|---------------|---------------|---------------|---------------|---------------|
5353
|[![NuGet](https://img.shields.io/nuget/v/Standard.Network.Library)](https://www.nuget.org/packages/Standard.Network.Library)| [![NuGet](https://img.shields.io/nuget/v/Protobuf.Network.Library)](https://www.nuget.org/packages/Protobuf.Network.Library/)|[![NuGet](https://img.shields.io/nuget/v/MessagePack.Network.Library)](https://www.nuget.org/packages/MessagePack.Network.Library)|[![NuGet](https://img.shields.io/nuget/v/NetSerializer.Network.Library)](https://www.nuget.org/packages/NetSerializer.Network.Library)|[![NuGet](https://img.shields.io/nuget/v/Json.Network.Library)](https://www.nuget.org/packages/Json.Network.Library)
5454

@@ -86,7 +86,7 @@ This benchmarks is only sending message envelope with raw byte payload. For seri
8686
[SerializationBenchmarks](SerializationBenchmarks.md)
8787

8888

89-
# Code Samples & Documentation
89+
# Documentation & Code Samples
9090
## Byte Message TCP Server/Client
9191
Any chunk of byte array or array segment will reach the destination without fragmentation.
9292
```csharp
@@ -131,7 +131,8 @@ Hello I'm the server
131131
server.RemoteCertificateValidationCallback+= ...
132132
client.RemoteCertificateValidationCallback+= ...
133133
```
134-
For base Server/Client where raw bytes are transfered you can use following classes. Method and callback signarures are identical to byte message models.
134+
Base Server/Client where raw bytes are transfered. Method and callback signarures are identical to byte message models.
135+
There is no protocol implemented over base Server/Client, hence bytes may come fragmented depending on your MTU size.
135136
```c#
136137
AsyncTcpServer server = new AsyncTcpServer(port: 20000);
137138
AsyncTpcClient client = new AsyncTpcClient();
@@ -142,12 +143,12 @@ For base Server/Client where raw bytes are transfered you can use following clas
142143
SslServer server = new SslServer(2000, scert);
143144
SslClient client = new SslClient(ccert);
144145
```
145-
There is no protocol implemented over base Server/Client described above, so bytes may come fragmented depending on your MTU size.
146+
146147
## Serialized Networks
147-
Serialized Networks are implementations of generic classes provided by Standard Library
148+
Serialized Networks are implementations of generic classes provided by Core Library
148149
It is applicable to all serialization protocols.
149-
Examples here is only given for Protobuf-net,
150-
but signature is identical for any other provided serialization protocol(MessagePack, Json etc).
150+
</br>```Examples here is only given for Protobuf-net,
151+
but signature is identical for any other provided serialization protocol(MessagePack, Json etc)```.
151152

152153
## Pure Message Server/Client
153154
Implements a server client model where serialized messages are transfered atomically.
@@ -301,11 +302,11 @@ Method signatures and callbacks are identical to proto client/server model (also
301302
```
302303
Additionally there is a broadcast support for TCP and Udp. This allows a single message to be send to relay server and multiplexed to all reachable peers there.
303304
On Udp case, if holpucnh is active between 2 peers message is sent directly like regular message.
304-
``` c#
305+
``` c#yy
305306
client.BroadcastMessage(peerId, envelope);
306307
client.BroadcastUdpMessage(peerId, envelope);
307308
```
308-
Udp messages can be more than the datagram limit of 65,527 bytes. The system detects large udp messages as Jumbo messages and sends them in chunks. Receiving end with will try to reconstruct the message. if all the part did not arrive on timeout message will be dropped. In a nutsell it works same as regular udp.
309+
Udp messages can be more than the datagram limit of 65,527 bytes. The system detects large udp messages as Jumbo messages and sends them in chunks. Receiving end with will try to reconstruct the message. if all the parts does not arrive within a timeout message is dropped. In a nutsell it works same as regular udp.
309310
Max message size for udp is 16,256,000 bytes.
310311
</br>This is also applicable to Udp broadcasts.
311312
```c#
@@ -318,9 +319,12 @@ We have build in reliable udp protocol implemneted aswell which is TCP implement
318319
client.SendRudpMessageAndWaitResponse(peerId, envelope, innerMessage);
319320
client.SendRudpMessageAndWaitResponse(peerId, envelope);
320321
```
321-
On top of that 3 channels are provided for Rudp. Ch1,Ch2 and Realtime.
322+
On top of that 3 independent channels are provided for Rudp. Ch1,Ch2 and Realtime.
323+
Reason for this is if you send a large message like a file from single channel, it will be blocked until message is completely sent. hence subsequent messages has to wait in buffer.
324+
By having independent channels this issue is avoided.
325+
322326
Ch1 and 2 are standard channels with same timeout mechanics of windows TCP implmentation.
323-
</br> Realtime channel is more sensitive to timeouts and may resend messages "pre-emtively". but resends are much faster so data is delivered reliably with minimum delay.
327+
</br> Realtime channel is more sensitive to timeouts and may resend messages "pre-emtively". But resends are much faster so data is delivered reliably with minimum delay.
324328
```c#
325329
client.SendRudpMessage(peerId, envelope, RudpChannel.Ch1);
326330
client.SendRudpMessage(peerId, envelope, RudpChannel.Ch2);

0 commit comments

Comments
 (0)