Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: How to connect to server? #206

Open
eosfor opened this issue May 27, 2018 · 2 comments
Open

Question: How to connect to server? #206

eosfor opened this issue May 27, 2018 · 2 comments

Comments

@eosfor
Copy link

eosfor commented May 27, 2018

Hello colleagues, seems like i missed in all this :)

Say i've got a TSL, which defines a simple protocol and graph nodes and two messages - to add and get a node. I generated a dll file out of it and able to load it into a server instance. So i made a separate process to host this server instance.

Now i want to have a simple powershell client, which will be able to send commands to a server and receive output. So the first question is - how do i connect to a server. where do i specify server ip or host name and port? how do i authenticate against it? do i need to load the same dll into a client?

Thanks.

@yatli
Copy link
Contributor

yatli commented May 28, 2018

Yes the comm. protocol dll should also be loaded into the client. There are two ways to start a client from PS:

  • Right before you access Global.CloudStorage or anything that initializes a connection, set TrinityConfig.CurrentRunningMode = RunningMode.Client; -- this is the classical way of setting up a client. Also, if you have FanoutSearch, the module has an option to force initialization as a client.
  • A more modern approach is to use the GraphEngine.Client packages. It's still WIP but we're able to do something like TrinityClient client = new TrinityClient("trinity://127.0.0.1:5304"); client.RegisterCommunicationModlue<FanoutSearchModule>(); client.Start(); which is symmetrical with what you do with a server. This will also allow setting up authentication & support for other transports, e.g. grpc.

@eosfor
Copy link
Author

eosfor commented May 28, 2018

Ok, what i managed to do so far is the following.

  1. declared a comm. module by describing in TSL + protocol definitions
module SimpleServerCommunicationModule
{
	protocol AddSimpleNodeProtocol;
	protocol GetSimpleNodeProtocol;
}
  1. created a simple comm module implementation
  2. Imported the comm. module to a server side like this
    public class SimpleServer
    {
        public void Start()
        {
            TrinityServer srv = new TrinityServer();
            srv.RegisterCommunicationModule<TrinityClientModule>();
            srv.RegisterCommunicationModule<SimpleCommunicationModule.SimpleCommunicationModule>();
            srv.Start();
        }
    }
  1. imported the comm. module to a client side
            TrinityClient cl = new TrinityClient("localhost:5304");
            cl.RegisterCommunicationModule<SimpleCommunicationModule.SimpleCommunicationModule>();

            cl.Start();

So it seems i now able to connect. But is this a correct way? Will it change?

But i did not try to put any data into the server yet :). Will try soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants