MossbauerLab / TinyTcpServer

A small tcp server working under Mono or .NET (4.0) and provides hooks for handling data exchange with clients (works under mono and .net). Behaviour/protocol/reaction could be specified via custom C# script.

Home Page:https://mossbauerlab.github.io/TinyTcpServer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[1.2] Script Engine

EvilLord666 opened this issue · comments

There is a idea to make server awailable to work with any protocols, over TinyTcpServer itself (as transport layer). Possibly script engine will be Roslyn

An idea of script is to make server universal and adjustable Also it is better to configure server from app.config/

The main issue about Roslyn script engine is : how to pass current instance of server (FlexibleTcpServer) as ITcpServer for adding handlers from script.

Unfortunately at this time Roslyn is not suitable for us, we must have compatibility with net 4.0, but Roslyn allows only 4.5, trying to build it with codeDom (https://docs.microsoft.com/en-us/dotnet/framework/reflection-and-codedom/using-the-codedom)

I added compilation with CodeDom and now i am able to run script under net 4.0 however there is a restriction for Script -> It MUST have entry point: method Init in class ServerScript in namespace MossbauerLab.Flexibility see example script in FunctionalTests (SimpleScript.cs).

Now script engine works and tested (FlexibleTcpServer is server with C# script).