私はLinux上で動作するサーバーアプリケーションを持っています。このアプリケーションはRPC通信のためにprotobuf cとprotobuf.rpc.cファイルを使用して開発された でした。Windowsで実行中のC#とprotobufでLinux上で実行中のC
Windowsで実行されていたクライアントアプリケーションがあります。これは、protobuf-net.dllとProtobufRemote.dllをRPC通信に使用するC#で開発されました。同じサービスメソッドを持つ同じprotoファイルを使用しています。
以下のコードで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
しかし、私は、以下のようにC#クライアントアプリケーションからサービスメソッドを呼び出すようにしようとしていたときに、アプリケーションがハングし、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;
}
上記のシナリオによれば、私は以下の質問をしています。
このprotobufリモートc#dllがLinuxのcコードからのコミュニケーションを作成するのに役立つかどうか。そうでない場合は、LinuxのCコードで通信チャネルを作成する方法を教えてください。
Linuxのprotobuf cとprotobuf rpc.cファイルと通信するための代替のrpc dllがあれば、それを提供してください。
私の上記のアプローチが間違っていて、適切な解決策で修正するかどうか教えてください。
私を助けてください。明確でない場合は、下記のメールにお送りください。
*主にRPCスタックが停止しているように見えます。 IMOはまず、ProtobufRemote.dllがこのシナリオ用に設計されているかどうか(つまり、protobuf.rpc.cサービスと互換性があるかどうか)を確認します。 –