我正在开发一个视觉应用程序,它有两种模式:1)参数设置2)自动问题出在2)中,当我的应用程序通过TCP/IP等待信号时。accept()
调用 -method时程序冻结。我想在 GUI 上提供更改模式的可能性。因此,如果模式发生变化,则由另一个信号(message_queue)提供。所以我想中断accept状态。有没有简单的方法可以中断接受?
std::cout << "TCPIP " << std::endl;
client = accept(slisten, (struct sockaddr*)&clientinfo, &clientinfolen);
if (client != SOCKET_ERROR)
cout << "client accepted: " << inet_ntoa(clientinfo.sin_addr) << ":"
<< ntohs(clientinfo.sin_port) << endl;
//receive the message from client
//recv returns the number of bytes received!!
//buf contains the data received
int rec = recv(client, buf, sizeof(buf), 0);
cout << "Message: " << rec << " bytes and the message " << buf << endl;
Run Code Online (Sandbox Code Playgroud)
我读过相关内容select()
,但不知道如何使用它。有人可以给我一个提示,例如如何select() …
现在我正在使用nifi及其处理器来处理一些流媒体内容(mqtt侦听器,json评估,文本替换,写入db ...)。我试图持久化流文件,因此进行了一些卷映射(请参见下文)。但这是行不通的。重新启动容器后,似乎没有保存流文件...
有人可以提示我如何解决该问题吗?
nifi:
image: apache/nifi
restart: on-failure
ports:
- "8000:8000"
networks:
- traefik
environment:
- NIFI_WEB_HTTP_PORT=8000
volumes:
- nifi_conf:/opt/nifi/conf
- nifi_state:/data/nifi/state
- nifi_db:/opt/nifi/database_repository
- nifi_flowfile:/opt/nifi/flowfile_repository
- nifi_content:/opt/nifi/content_repository
- nifi_provenance:/opt/nifi/provenance_repository
volumes:
nifi_provenance:{}
nifi_flowfile: {}
nifi_content: {}
nifi_db: {}
nifi_state: {}
nifi_conf: {}
Run Code Online (Sandbox Code Playgroud)
谢谢。