• Schlagwort-Archive: Tutorial

Supported data types

Supported are all primative data types, which includes String Int16 Int32 Int64 Boolean Byte Char Decimal Double Single UInt16 UInt32 UInt64 Enums will be automatically mapped to an UInt32. In advance you can ship those types as Standalone As an array As a list

Classes You can also send and receive „custom“ classes, as… Lesen Sie den ganzen Artikel

Packet structure

The most „complicated“ thing with this library is clearly the packet structure. We have to keep some things in mind to guarantee a flawless serialization. We differ between two packet types. The Request and the response packet. Request Packet The request packet is used to „start“ a conversation. We literally request something.

We always… Lesen Sie den ganzen Artikel

Send/Receive packets

The server can only register each packet type once. Therefore, on serverside we have to use the „RegisterStaticPacketHandler“ method. That will map a packettype directly to the given delegate. In the following example we start to listen to a „CalculationRequest“ after a connection has been established.

connection.RegisterStaticPacketHandler registers the generic <CalculationRequest> to the delegate… Lesen Sie den ganzen Artikel

Send and receive a packet async

Send and receive a packet with a delegate

 

Send and receive a packet in a lambda

 

Client Setup

[TCP/UDP] ClientConnectionContainer The ClientConnectionContainer contains a TCP and a UDP connection by default. In addition the ClientConnectionContainer supports: Reconnecting if the TCP and/or the UDP connection has been lost Offering various methods to send data (async, fast, slow) Buffering packets if there is no available connection Remember your settings and packet-configurations after a reconnect

… Lesen Sie den ganzen Artikel

Server Setup

After „StartTCPListener();“ the Server is up and running. The TCPListener is also in charge of the UDP connections. The property „AllowUDPConnections“ indicates whether the server is going to accept incomming UDP connections.

Library Setup

The easiest way to access the library is via NuGet. If Visual Studio doesn’t contain a NuGet Extension, download and install it manually. Instead of NuGet you can simply download the binaries. Setup with NuGet Expand the project, right click „References“ and select „Manage NuGet Packages…“ Search for „Network“ or „Thomas Christof“, select the „Network by Thomas… Lesen Sie den ganzen Artikel

Schließen