From 3a89a77e79407d0d638ddf983ee580410cf807c5 Mon Sep 17 00:00:00 2001
From: wangzhengquan <wangzhengquan85@126.com>
Date: 星期二, 04 八月 2020 15:56:12 +0800
Subject: [PATCH] fix sendto

---
 src/socket/include/shm_socket.h |   28 +++++++++++++++++++---------
 1 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/src/socket/include/shm_socket.h b/src/socket/include/shm_socket.h
index 0ca4cfd..dd93f75 100644
--- a/src/socket/include/shm_socket.h
+++ b/src/socket/include/shm_socket.h
@@ -5,9 +5,7 @@
 #include "usg_typedef.h"
 #include "shm_queue.h"
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+ 
 
 enum shm_msg_type_t
 {
@@ -18,11 +16,22 @@
 	
 };
 
+enum shm_socket_flag_t
+{
+  SHM_MSG_TIMEOUT = 1,
+  SHM_MSG_NOWAIT = 2
+};
+
 enum shm_socket_type_t
 {
 	SHM_SOCKET_STREAM = 1,
 	SHM_SOCKET_DGRAM = 2
 	
+};
+
+enum shm_socket_error_type_t {
+	SHM_SOCKET_CONN_FAILED = 1,
+	SHM_SOCKET_TIMEOUT = 2	
 };
 
 enum shm_connection_status_t {
@@ -38,6 +47,8 @@
 	void * buf;
 
 } shm_msg_t;
+
+
 
 
 typedef struct shm_socket_t {
@@ -77,17 +88,16 @@
 
 int shm_send(shm_socket_t * socket, const void *buf, const int size) ;
 
-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 shm_recv(shm_socket_t * socket, void **buf, int *size) ;
 
-int shm_sendto(shm_socket_t *socket, const void *buf, const int size, const int port, const struct timespec * timeout = NULL);
+int shm_sendto(shm_socket_t *socket, const void *buf, const int size, const int port, const struct timespec * timeout = NULL, const int flags=0);
 
-int shm_recvfrom(shm_socket_t *socket, void **buf, int *size, int *port);
+int shm_recvfrom(shm_socket_t *socket, void **buf, int *size, int *port,   struct timespec * timeout = NULL,  int flags=0);
+
+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,  
+	struct timespec * timeout = NULL,  int flags=0);
 
 
-#ifdef __cplusplus
-}
-#endif
 
 #endif
\ No newline at end of file

--
Gitblit v1.8.0