Unity3d Apache Thrift Server

Hello!

I am using Apache Thrift to have Unity act as a Thrift Server. When I try to do that, once it calls the “server.Serve()” it locks up Unity.

Here is the code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Thrift.Server;
using Thrift.Transport;
using System;

public class CSharpServer : MonoBehaviour
{

    // Use this for initialization
    void Start()
    {
        Application.runInBackground = true;

        try
        {
            CSharpTutorial.CalculatorHandler handler = new CSharpTutorial.CalculatorHandler();
            Calculator.Processor processor = new Calculator.Processor(handler);
            TServerTransport serverTransport = new TServerSocket(9090);
            TServer server = new TSimpleServer(processor, serverTransport);

            // Use this for a multithreaded server
            //TServer server = new TThreadPoolServer(processor, serverTransport);

            Debug.Log("Starting the server...");
            server.Serve(); // <-- This is the line that causes the lockup.
        }
        catch (Exception x)
        {
            Debug.Log(x.StackTrace);
        }
        Debug.Log("done.");
    }

}

Having Unity work as a Client works just fine. It can call a Server written in any language with no issues. All the examples I can find only show Unity as a Client and not as a server.

The purpose of this is due to that I need two way communication using Thrift. Therefore the client can call the server and the server can call the client.

I can just have the client Poll the Server every x seconds to get see if there are any messages but I’m trying this method first.

I am trying this on both Unity 5.6.1 and Unity 2017.1
Using Thrift 0.10.0
Windows Stand Alone Build

I have already Googled “unity3d thrift server” and went through the first 20 pages and all their links with no result ( the ones that do really talk about it are set for Unity as a client )

Thanks for any and all help.

Hi

matrix211v1

, did you find a solution for this