**• Hardware Platform (Jetson / GPU)**Jetson
• DeepStream Version6.1.1
Sample using: deepstream-app
Hi,I am trying to send messages via ZeroMQ, I try to put it under the main function,but failed.
Then I try to put it under process_meta() function under deepstream_app.c file:
process_meta (AppCtx * appCtx, NvDsBatchMeta * batch_meta){
void *socket = zmq_socket(context, ZMQ_PUB);
void *publisher = zmq_socket(context, ZMQ_PUB);
if (zmq_bind(socket, "tcp://*:5555") != 0) {
perror("绑定端口失败");
zmq_close(socket);
return NULL;
}
sleep(2);
GstBuffer *buf = (GstBuffer *) info->data;
//extra
NvDsBatchMeta *batch_meta = gst_buffer_get_nvds_batch_meta(buf);
for (NvDsMetaList * l_frame = batch_meta->frame_meta_list; l_frame != NULL;
l_frame = l_frame->next) {
NvDsFrameMeta *frame_meta = l_frame->data;
for (NvDsMetaList * l_obj = frame_meta->obj_meta_list; l_obj != NULL;
l_obj = l_obj->next) {
NvDsObjectMeta *obj = (NvDsObjectMeta *) l_obj->data;
float x = obj->rect_params.left;
float y = obj->rect_params.top;
float width = obj->rect_params.width;
float height = obj->rect_params.height;
float mid_x=x+width / 2.0f;
float mid_y=x+height / 2.0f;
float angle=obj->misc_obj_info[0];
char message[256];
snprintf(message, sizeof(message), "%d,%d,%.2f", x, y, angle);
int bytes_sent = zmq_send(socket, message, strlen(message), 0);
if (bytes_sent == -1) {
printf("消息发送失败: %s\n", zmq_strerror(zmq_errno()));
}
else {
printf("发送坐标和角度: %s\n", message);
}
sleep(1);
}
zmq_close(socket);
return NULL;
}
}
The program works fine,but it seems that it don’t send any message because I try to receive the message in another python program,receiving nothing.
I wonder if the deepstream support ZeroMQ to send messages.
If yes,is something wrong with my codes position?
If no,what other ways I can try to send messages to other program.