gpt4 book ai didi

c# - DllNotFoundException:libzmq

转载 作者:太空狗 更新时间:2023-10-29 22:01:22 26 4
gpt4 key购买 nike

我正在尝试使用 ZeroMQ C# 绑定(bind) ( http://www.zeromq.org/bindings:clr ) 与我在 Unity 中创建的游戏的服务器进行通信(我使用的是 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)

有人有什么建议吗?

最佳答案

确保已将引用程序集的“复制本地”设置为 true。

关于c# - DllNotFoundException:libzmq,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13347156/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com