首页 > 解决方案 > HoloLens 2 无法连接到服务器

问题描述

我目前正在为 HoloLens 2 开发一个应用程序,其中 MRTK 和 MLAPI 作为网络后端。我有一个服务器在一个单独的 Unity 项目中运行,我的计算机上具有相同的资产,而客户端在 HoloLens 上运行,两者都在同一个 LAN 上。当客户端通过 HoloLens 使用 Holographic Remoting 运行时,连接成功启动并且一切正常。当客户端直接部署到 HoloLens 并在那里运行时,无法建立连接,服务器甚至看不到客户端尝试连接。这个问题和这个类似. 我已经验证设备上的 InternetClient、InternetClientServer 和 PrivateNetworkClientServer 功能都已启用。我还验证了这些设备实际上能够通过在我的计算机上运行一个简单的 Web 服务器并通过 HoloLens 连接到它来在应用程序之外进行通信。客户端连接的端口和地址也是正确的。

编辑更多信息:我正在使用 Unity 2019.4.19f1、MRTK 2.5.3 和 MLAPI 0.1.0。我还在为 MLAPI 使用 Ruffles 传输,尽管标准 Unet 传输也会发生这种情况(我刚刚发现 Ruffles 调试消息更有用,所以我正在使用它)。服务器的控制台中什么也没有出现,客户端有非常标准的消息:

Socket Initialized
Creating NetworkThread #0
Creating SocketThread #0
Starting NetworkThread #0
Starting SocketThread #0
Started 2 threads
Attempting to connect to 192.18.1.213:7777
Using time based connection challenge. Calculating with difficulty 20
Found has collision after 1945710 attempts.
Using time based connection challenge. Writing solve with difficulty 20
Sending connection request to 192.168.1.213:7777
Resending ConnectionRequest with challenge
Resending ConnectionRequest with challenge
Resending ConnectionRequest with challenge
Resending ConnectionRequest with challenge
Resending ConnectionRequest with challenge
Disconnecting client because handshake was not started
[MLAPI] Disconnect Event from 1
[MLAPI] StopClient
[MLAPI] Shutdown
Joining SocketThread #0
Joining NetworkThread #0
Joined 2 threads
Releasing all memory held by MemoryManager to GC
Releasing MemoryWrappers to GC
Released 0 MemoryWrappers to GC
Releasing HeapPointers to GC
Released 0 HeapPointers to GC
Releasing HeapMemory to GC
Released 1 HeapMemories to GC
Released all memory held by MemoryManager to GC

标签: unity3dnetworkinghololensmrtk

解决方案


推荐阅读