我正在研究在移动设备上运行的HTML/Javascript,它与在PC上运行的Qt/C++应用程序进行通信.移动设备和PC都在本地网络上.HTML页面(客户端)和C++应用程序(服务器)之间的通信是使用Websockets完成的.
HTML页面是C++应用程序的远程控制,因此需要在移动设备和PC之间建立低延迟连接.
当使用任何非Apple设备作为客户端时,数据将以60到120帧/秒的速率发送,这是完全可以接受的.使用Apple设备时,此速率降至3-4帧/秒.我还检查了ping时间(Websocket实现,而不是命令行的ping命令).只要设备不传输数据,Apple设备就可以接受(1-5毫秒).无论何时传输数据,此ping时间都会增加到200ms.
从Javascript方面来看,Apple设备始终以60帧/秒的一致速率发送数据,就像其他任何设备一样.但是,在服务器端,当客户端是Apple设备时,仅接收这60个帧中的3到4个.
有没有人知道会发生什么?
这是我的Javascript代码:
<script language="javascript" type="text/javascript">
var wsUri = document.URL.replace("http", "ws");
var output;
var websocket;
function init()
{
output = document.getElementById("output");
wsConnect();
}
function wsConnect()
{
console.log("Trying connection to " + wsUri);
try
{
output = document.getElementById("output");
websocket = new WebSocket(wsUri);
websocket.onopen = function(evt)
{
onOpen(evt)
};
websocket.onclose = function(evt)
{
onClose(evt)
};
websocket.onmessage = function(evt)
{
onMessage(evt)
};
websocket.onerror = function(evt)
{
onError(evt)
};
}
catch (e)
{
console.log("Exception " + e.toString());
}
} …Run Code Online (Sandbox Code Playgroud) 我知道 Qmake 提供了 contains 函数来检查变量是否包含某个值:
contains( CONFIG, PartialStatic ) {
// my code here
}
Run Code Online (Sandbox Code Playgroud)
有没有“不包含”这样的东西?
notcontains( CONFIG, PartialStatic ) {
// my code here
}
Run Code Online (Sandbox Code Playgroud)
而不是必须这样做:
contains( CONFIG, PartialStatic ) {
}
else {
// my code here
}
Run Code Online (Sandbox Code Playgroud)
我没有看到 Qt 文档中提到的任何类似内容。
我是Cuda的新手,刚开始编写一个简单的程序来测试它.其中可能存在很多问题,但我现在的阻止是我在标题中描述的错误:每当我声明一个简单的cudaError_t变量时,我都会收到"无法识别的令牌"编译错误.这是我的代码示例:
#include <cuda_runtime.h>
#include <cuda_runtime_api.h>
extern "C" void callCudaCode(int*);
__global__ void mykernel (int *a, int *b, int *c)
{
//*c = *a + *b;
*c = 34;
}
void callCudaCode(int* results)
{
int a=3, b=8;
int *da, *db, *dc;
int size = sizeof(int);
?cudaError_t myCudaError;// = cudaGetLastError();
//const char* errorStr = cudaGetErrorName(cudaError);
cudaMalloc((void**)da, size);
cudaMalloc((void**)db, size);
cudaMalloc((void**)dc, size);
cudaMemcpy(da, &a, size, cudaMemcpyHostToDevice);
cudaMemcpy(db, &b, size, cudaMemcpyHostToDevice);
mykernel<<<1,1>>>(da,db,dc);
cudaMemcpy(results, dc, size, cudaMemcpyDeviceToHost);
cudaFree(da);
cudaFree(db);
cudaFree(dc);
}
Run Code Online (Sandbox Code Playgroud)
还有另一个main.cpp文件使用这个文件,但我认为它没有任何相关的解释这个错误,所以我没有包含它.如果我评论cudaError_t变量声明,代码编译正常(它执行不正常,但这是另一个故事).
我已经搜索了这个问题,但只发现了与我的例子没有任何关系的错误:空间错误,printf错误......
根据我的理解,cudaError_t是一个在cuda_runtime_api.h中定义的枚举,所以通过包含它我不应该有任何问题......
有没有人知道发生了什么?
编辑 …