Unity で作成しているゲームのサーバーと通信するために、 ZeroMQ C# バインディング ( http://www.zeromq.org/bindings:clr ) を使用しようとしています (Mac OS X 10.8 を使用しています)。したがって、サーバーに接続し、メッセージを送信してからメッセージを受信する単純な関数を作成しました。
using UnityEngine;
using System.Runtime.InteropServices;
using System.Collections;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ZeroMQ;
public class NetworkZero : MonoBehaviour {
// Use this for initialization
public static NetworkZero instance;
void Start () {
instance = this;
Debug.Log("START NETWORK COMMUNICATION");
}
// Update is called once per frame
void Update () {
using (ZMQ.Context context = new ZMQ.Context(1))
using (ZMQ.Socket client = context.Socket(ZMQ.SocketType.REQ))
{
string sendMSG = "CLIENT";
client.Connect("tcp://localhost:31415");
client.Bind("tcp://localhost:31415");
client.Send(sendMSG, Encoding.Unicode);
string message = client.Recv(Encoding.Unicode);
Debug.Log("Received request: " + message);
}
}
}
指示に従って、必要なライブラリをプロジェクトに含め、monoDevelop でこれらのライブラリへの参照を追加しました。しかし、プログラムのビルド中にプログラムを実行しようとすると、まだ次のエラーが表示されます。
DllNotFoundException: libzmq
ZMQ.Context..ctor (Int32 io_threads)
NetworkZero.Update () (at Assets/SLIP/NetworkZero.cs:26)
誰か提案はありますか?