From 46963c736e76cc0e23e361d7a59bbf95da3e8419 Mon Sep 17 00:00:00 2001 From: wangzhengquan <wangzhengquan85@126.com> Date: 星期四, 23 七月 2020 16:36:41 +0800 Subject: [PATCH] hear beat --- src/socket/shm_socket.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/src/socket/shm_socket.c b/src/socket/shm_socket.c index 5b8b9c0..6708469 100644 --- a/src/socket/shm_socket.c +++ b/src/socket/shm_socket.c @@ -302,6 +302,19 @@ } } +int shm_sendandrecv(shm_socket_t *socket, const void *send_buf, const int send_size, const int send_port, void **recv_buf, int *recv_size) { + int recv_port; + int rv; + + shm_socket_t *tmp_socket = shm_open_socket(SHM_SOCKET_DGRAM); + if (shm_sendto(tmp_socket, send_buf, send_size, send_port) == 0) { + rv = shm_recvfrom(tmp_socket, recv_buf, recv_size, &recv_port); + shm_close_socket(tmp_socket); + return rv; + } + return -1; +} + /** * 缁戝畾key鍒伴槦鍒楋紝浣嗘槸骞朵笉浼氬垱寤洪槦鍒椼�傚鏋滄病鏈夊搴旀寚瀹歬ey鐨勯槦鍒楁彁绀洪敊璇苟閫�鍑� -- Gitblit v1.8.0