2012-03-29 2 views
0

Linux에서 실행되는 서버 응용 프로그램이 있습니다. 이 응용 프로그램은 RPC 통신을 위해 protobuf c 및 protobuf.rpc.c 파일을 사용하여 개발 된 입니다.Windows에서 실행중인 C#과 protobuf로 Linux에서 실행중인 C 간의 통신

windows에서 실행되는 클라이언트 응용 프로그램이 있습니다. 이것은 protobuf-net.dll 및 ProtobufRemote.dll을 RPC 통신용으로 사용하여 개발되었습니다. 동일한 서비스 방법을 사용하는 동일한 proto 파일을 사용하는 두 응용 프로그램 모두.

아래 코드로 C# 클라이언트 응용 프로그램에서 프록시를 만들 수 있습니다. 아래 그림과 같이 내가 C# 클라이언트 응용 프로그램에서 서비스 메소드를 호출하려고 할 때마다

using System.Configuration; 
using System.Net.Sockets; 
using ProtoBufRemote; // rpc reference 
using StarCall; // proto file 

#region Create client connection 

      Int32 port = Convert.ToInt32(ConfigurationManager.AppSettings["PORT"]); 
      TcpClient tcpClient = new TcpClient(ConfigurationManager.AppSettings["SERVERIP"].ToString(), port); 

      var controller = new RpcController(); 
      var client = new RpcClient(controller); 

      var channel = new NetworkStreamRpcChannel(controller, tcpClient.GetStream()); 
      channel.Start(); 

      var service = client.GetProxy<Istarcall_services>(); 

      if (service == null) 
       Console.WriteLine("error creating client.."); 

      //now calls can be made, they will block until a result is received 
      Console.WriteLine("Client connected to Server....\n"); 
    #endregion 

그러나, 응용 프로그램이 매달려 및 Linux C 서버 응용 프로그램에서 어떠한 반응을 얻고 있지 않습니다.

 try 
     { 
      Room_Config room = new Room_Config(); 
      room.Room_Dial_Num = 1; 
      Room_Config roomRet = service.read_room(room); // service method 
     } 
     catch (Exception) 
     { 


     throw; 
    } 

응용 프로그램이 아래 코드에 걸려 있습니다.

protected RpcMessage.Parameter EndAsyncCallHelper(string methodName, IAsyncResult asyncResult) 
     { 
      PendingCall pendingCall = (PendingCall)asyncResult; 

      pendingCall.AsyncWaitHandle.WaitOne(); // application hanging here 
      pendingCall.AsyncWaitHandle.Close(); 

      if (pendingCall.IsFailed) 
       throw new InvalidRpcCallException(serviceName, methodName, 
        String.Format("Server failed to process call, returned error message: \"{0}\".", 
        pendingCall.ServerErrorMessage)); 

      return pendingCall.Result; 
     } 

위에서 언급 한 시나리오에 따르면 다음과 같은 쿼리가 있습니다.

  1. 이 protobuf 원격 C# dll이 Linux c 코드에서 의사 소통을 만드는 데 도움이되는지 여부. 그렇지 않으면 리눅스 C 코드로 통신 채널을 만드는 방법을 알려주십시오.

  2. cp 클라이언트 응용 프로그램이 Linux protobuf c 및 protobuf rpc.c 파일과 통신 할 수있는 다른 대체 rpc dll을 제공하십시오.

  3. 내 위의 접근 방법이 잘못된지 알맞은 해결책으로 알려주십시오.

제발 도와주세요. 명확하지 않으면 아래에 언급 된 메일로 보내주십시오.

+0

* 주로 RPC 스택이 멈추는 것처럼 들립니다. IMO는 먼저 ProtobufRemote.dll이이 시나리오 (즉, protobuf.rpc.c 서비스와 호환되는지 여부)를 위해 설계되었는지 여부를 확인합니다. –

답변

0

Linux에서 ProtoBufRemote cpp (https://code.google.com/p/protobuf-remote/)를 사용하여 서버를 구현 했습니까 ??

그렇다면 Linux에서 사용할 수없는 WinSock2를 사용하는 것처럼 SocketRpcChannel.cpp 클래스를 바꾸거나 수정해야합니다. 그렇게하셨습니까? 그렇다면 서버에서 사용한 수정 된 SocketRpcChannel 클래스를 공유하십시오.

감사합니다.

관련 문제