I'm trying to use ZeroMQ C#-binding ( http://www.zeromq.org/bindings:clr ) for communicating with a server for a game I'm creating in Unity (I'm using Mac OS X 10.8). I therefore created a simple function that connects to a server, sends a message and then receives a message:
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);
}
}
}
I followed the instructions to include the necessary libraries in my project and in monoDevelop added references to these libraries. But while the program builds, I still get the following error when I try to run the program:
DllNotFoundException: libzmq
ZMQ.Context..ctor (Int32 io_threads)
NetworkZero.Update () (at Assets/SLIP/NetworkZero.cs:26)
Does anyone have any suggestions?