Hi, I’ve been trying to use Thrift on Unity. On one project I try creating a Server which gets some information from the Kinect and on another Unity Project(running in a different computer) I create a client which requests it.
The problem is that whenever the server starts Unity freezes. Same with the client. It starts and immediately. When the server is stopped, the client unfreezes.
A second problem is that when I try to start the server again Unity stops working and I need to stop the task from the task manager.
Do you have any insights on what may be happening here and how to solve it? (specially for the first problem)
Have you already made a similar application (using thrift for client and server in unity) that could hep me figure out the problem?
My project has that option active. The current situation is the following:
On one computer there is a server and also a client (which connects to localhost).
On another computer with the same project there is only a client which connects to the server running on the first computer.
On the first computer there seems to be no problem, the function returns the expected values which are then printed.
The second computer, however, freezes, and with freezes I mean I can’t even stop the running project. It remains frozen until the server stops running. The the project on the second computer continues to run normally. I should probably mention that pinging the first computer works and all firewalls are currently down.
Were you able to get Unity to use Thrift as a Server? I can get it to work as a Client but when I put it as a Sever, it locks up the Editor.
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(9091);
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 line locks up the Unity Editor
}
catch (Exception x)
{
Debug.Log(x.StackTrace);
}
Debug.Log(“done.”);
}