简体   繁体   English

关于微软的 Windows-universal-samples

[英]Regarding Windows-universal-samples of Microsoft

Could any one tell me this code 1 , is this function runs every time when it gets a new video frame, if yes then I made a thread after line 188 which basically make a TCP connection with the server and send that frame to server.谁能告诉我这个代码1 ,这个 function 是否每次在获得新的视频帧时都会运行,如果是,那么我在第 188 行之后创建了一个线程,它基本上与服务器建立了 TCP 连接并将该帧发送到服务器。 But the problem is if this function runs every time it make every time new thread and make new socket connection, but I want this thread to make one time connection and then send frame every time it get to the already connected TCP socket.但问题是,如果这个 function 每次都运行新线程并建立新的套接字连接,但我希望这个线程进行一次连接,然后每次到达已经连接的 TCP 套接字时发送帧。 The thread I am making is with this code,我正在制作的线程是使用此代码,

Task task = new Task(() => { _helper.TcpConnectAndSend(originalBitmap); });
task.Start();

Windows-universal-samples Windows 通用示例

but I want this thread to make one time connection and then send frame every time it get to the already connected TCP socket.但我希望这个线程进行一次连接,然后每次到达已经连接的 TCP 套接字时发送帧。

As Raymond Chen said, you called TcpConnectAndSend each time after getting frame that will make connecting repeatedly.正如Raymond Chen 所说,你每次获取帧后都会调用TcpConnectAndSend ,这会导致重复连接。

The better way is connect TCP socket after camera initialize , and then call send method for each fream.更好的方法是在相机初始化后连接TCP socket,然后为每个fream调用send方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 GPS Windows Mobile 6(使用Microsoft.WindowsMo​​bile.Samples.Location;) - GPS Windows Mobile 6 (using Microsoft.WindowsMobile.Samples.Location;) 运行 Windows 通用示例时如何解决 DEP6957 错误? - How to resolve DEP6957 error when running Windows Universal Samples? 在通用Windows平台(UWP)应用程序中使用Microsoft.AspNet.Mvc - Use Microsoft.AspNet.Mvc in Universal Windows Platform (UWP) Application 如何将屏幕截图上载到Microsoft Store for Windows 8.1 Universal App - How to Upload Screenshots to Microsoft Store for Windows 8.1 Universal App Windows Universal App从Microsoft帐户身份验证获取用户名 - Windows Universal App Get username from Microsoft Account Authentication 通用Windows应用程序如何具有多个独立窗口(如Microsoft的应用程序“照片”)? - How can a universal windows app have multiple independent windows (Like Microsoft's app “Photos”)? Microsoft HPC 2012代码示例 - Microsoft HPC 2012 Code Samples 如何在Universal Windows Platform项目中添加Microsoft.AnalysisService.AdomdClient.dll? - How to add Microsoft.AnalysisService.AdomdClient.dll in Universal Windows Platform project? 通用Windows数据表丢失 - Universal Windows Datatable is missing 通用Windows中的BluetoothLE - BluetoothLE In Universal Windows
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM