经过几周的挫折后,我终于能够将一个字符串从 Python 客户端发送到 Hololens 服务器。代码如下并且运行完美。但是,我想知道是否有使用套接字经验的人可以帮助我修改此代码以将 openCV 网络摄像头帧(基本上只是发送图像)从 Python 发送到 Hololens。我一直在尝试,但 C# 脚本中似乎没有收到图像数据。
太感谢了。
Hololens服务器代码:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
#if !UNITY_EDITOR
using Windows.Networking;
using Windows.Networking.Sockets;
using Windows.Storage.Streams;
#endif
//Able to act as a reciever
public class UniversalSampleTutorial : MonoBehaviour
{
public String _input = "Waiting";
#if !UNITY_EDITOR
StreamSocket socket;
StreamSocketListener listener;
String port;
String message;
#endif
// Use this for initialization
void Start()
{
#if !UNITY_EDITOR
listener = new StreamSocketListener();
port = "9090";
listener.ConnectionReceived += …Run Code Online (Sandbox Code Playgroud)