Echo.Server 4.0.0

dotnet add package Echo.Server --version 4.0.0
                    
NuGet\Install-Package Echo.Server -Version 4.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Echo.Server" Version="4.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Echo.Server" Version="4.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Echo.Server" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Echo.Server --version 4.0.0
                    
#r "nuget: Echo.Server, 4.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Echo.Server@4.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Echo.Server&version=4.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Echo.Server&version=4.0.0
                    
Install as a Cake Tool

Echo Server

Echo Server is a server

Installation

Echo Server is a TCP server for sending and receiving objects synchronously.

Usage


using Echo.Server;

namespace EchoTest
{
    class Program
    {
        static void Main(string[] args)
        {
            // Create server
            EchoServer<Question, Reply> server = new EchoServer<Question, Reply>(IPAddress.Parse("127.0.0.1"), 8888);
            // Bind event (message from client)
            server.OnMessage = OnServerMessage;
            // Start the server
            server.Start();

            Console.Write("Press any key to stop the server");
            // Shutdown server
            server.Close();
            Console.ReadKey();
        }

        private static Reply OnServerMessage(ClientInfo clientInfo, Question question)
        {
            Reply reply = new Reply();
            reply.Answer = $"{question.Ask} => Fine!";
            return reply;
        }
    }
}

namespace Common
{
    [Serializable]
    public class Question
    {
        public string Ask { get; set; }
    }
    [Serializable]
    public class Reply
    {
        public string Answer { get; set; }
    }
}

Contributing

Please make sure to update tests as appropriate.

License

MIT

Product Compatible and additional computed target framework versions.
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.0 528 9/27/2021
3.0.0 444 9/27/2021
2.0.0 460 9/27/2021
1.0.0 464 9/27/2021

Improve memory usage